From 78750190adc7bda6aa9109e19c89adc1e047a983 Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Sat, 19 Jun 2021 14:58:31 -0500 Subject: [PATCH] Exit correctly if shellcheck detects problems --- pre-commit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pre-commit b/pre-commit index 95299e4..1308f40 100755 --- a/pre-commit +++ b/pre-commit @@ -20,8 +20,8 @@ git status -zu | while read -rd '' xy filename; do fi if [[ $filename = *.sh ]] || is_a "$filename" bash; then - if has shellcheck; then - shellcheck -s bash "$filename" + if has shellcheck && ! shellcheck -s bash "$filename"; then + exit 1 fi fi done