check if shellcheck is installed

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2019-04-18 21:11:44 +02:00
parent 8bb14ec909
commit 12fd839e72
1 changed files with 10 additions and 1 deletions

View File

@ -17,11 +17,20 @@ echo "............................"
unset IFS; set -f
# check for shellcheck
if which shellcheck >/dev/null 2>&1; then
echo "Test all scripts with shellcheck ..."
else
echo "Error: shellcheck is not installed. Install shellcheck or delete $0"
exit 1
fi
# run shellcheck before commit
FILES=$(sed '/^#/d' <"hooks/shellcheck.files")
if [ "$FILES" != "" ]; then
# shellcheck disable=SC2086
shellcheck -x ${FILES}
shellcheck -x ${FILES} || exit 1
echo "OK"
else
# something went wrong
exit 1