From 12fd839e72e09e33b860e9645f137f5ee77d1091 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Thu, 18 Apr 2019 21:11:44 +0200 Subject: [PATCH] check if shellcheck is installed --- hooks/pre-commit.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hooks/pre-commit.sh b/hooks/pre-commit.sh index 2c6afd4..6a3e76c 100755 --- a/hooks/pre-commit.sh +++ b/hooks/pre-commit.sh @@ -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