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
|
if [ "$*" != "" ]; then
|
||||||
args="$*"
|
args="$*"
|
||||||
else
|
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
|
fi
|
||||||
|
|
||||||
# Gather the list of files that appear to be shell scripts.
|
# Gather the list of files that appear to be shell scripts.
|
||||||
# Meaning they have some form of "#!...sh" as a line in them.
|
# 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
|
for file in ${shFiles}; do
|
||||||
grep "set -o errexit" $file > /dev/null 2>&1 && continue
|
grep "set -o errexit" $file > /dev/null 2>&1 && continue
|
||||||
grep "set -[a-z]*e" $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)
|
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
|
for file in ${mdFiles}; do
|
||||||
# echo scanning $file
|
# echo scanning $file
|
||||||
dir=$(dirname $file)
|
dir=$(dirname $file)
|
||||||
@ -74,7 +73,7 @@ for file in ${mdFiles}; do
|
|||||||
|
|
||||||
# An external href (ie. starts with http)
|
# An external href (ie. starts with http)
|
||||||
if [ "${ref:0:4}" == "http" ]; then
|
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
|
echo $file: Can\'t load: url ${ref} | tee -a ${tmp}3
|
||||||
fi
|
fi
|
||||||
continue
|
continue
|
||||||
|
|||||||
@ -115,7 +115,7 @@ def file_extension(filename):
|
|||||||
|
|
||||||
SKIPPED_DIRS = [
|
SKIPPED_DIRS = [
|
||||||
'Godeps', 'third_party', '_gopath', '_output',
|
'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
|
# even when generated by bazel we will complain about some generated files
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user