Use mktemp in verify-errexit and verify-links
Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
parent
77c63bdc2d
commit
a87e7cdccc
@ -31,14 +31,17 @@ REPO_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
if [ "$*" != "" ]; then
|
||||
args="$*"
|
||||
else
|
||||
args=$(ls "$REPO_ROOT" | grep -v vendor | grep -v glide)
|
||||
args=$(ls "$REPO_ROOT" | grep -v vendor | grep -v glide | grep -v 'bazel-' )
|
||||
fi
|
||||
|
||||
# Gather the list of files that appear to be shell scripts.
|
||||
# Meaning they have some form of "#!...sh" as a line in them.
|
||||
shFiles=$(grep -rl '^#!.*sh$' $args)
|
||||
shFiles=$(grep -Rrl '^#!.*sh$' $args)
|
||||
|
||||
tmp=$(mktemp)
|
||||
# Delete the temporary file as it should only exist if errors have occurred.
|
||||
rm $tmp
|
||||
|
||||
tmp=/tmp/out$RANDOM
|
||||
for file in ${shFiles}; do
|
||||
grep "set -o errexit" $file > /dev/null 2>&1 && continue
|
||||
grep "set -[a-z]*e" $file > /dev/null 2>&1 && continue
|
||||
|
||||
@ -38,9 +38,8 @@ fi
|
||||
|
||||
mdFiles=$(find "${args}" -name "*.md" | grep -v vendor | grep -v glide)
|
||||
|
||||
tmp=/tmp/out${RANDOM}
|
||||
tmp=$(mktemp)
|
||||
|
||||
rm -f /tmp/$tmp*
|
||||
for file in ${mdFiles}; do
|
||||
# echo scanning $file
|
||||
dir=$(dirname $file)
|
||||
@ -74,7 +73,7 @@ for file in ${mdFiles}; do
|
||||
|
||||
# An external href (ie. starts with http)
|
||||
if [ "${ref:0:4}" == "http" ]; then
|
||||
if ! curl --connect-timeout 10 -o /dev/null ${ref} > /dev/null 2>&1 ; then
|
||||
if ! wget --timeout 10 -o /dev/null ${ref} > /dev/null 2>&1 ; then
|
||||
echo $file: Can\'t load: url ${ref} | tee -a ${tmp}3
|
||||
fi
|
||||
continue
|
||||
|
||||
@ -115,7 +115,7 @@ def file_extension(filename):
|
||||
|
||||
SKIPPED_DIRS = [
|
||||
'Godeps', 'third_party', '_gopath', '_output',
|
||||
'.git', 'vendor', '__init__.py', 'node_modules'
|
||||
'.git', 'vendor', '__init__.py', 'node_modules',
|
||||
]
|
||||
|
||||
# even when generated by bazel we will complain about some generated files
|
||||
|
||||
Loading…
Reference in New Issue
Block a user