From a523c9968f14b47964040a193c47fdcc701de267 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 12 Jul 2018 22:32:50 +0200 Subject: [PATCH] Improve whitespace check --- Hooks/syntax.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Hooks/syntax.sh b/Hooks/syntax.sh index 8231779..9f2b571 100644 --- a/Hooks/syntax.sh +++ b/Hooks/syntax.sh @@ -68,8 +68,9 @@ fi # Check whitespace end of line in code if [[ "$FILE" =~ ^.+(sh|js|php|json)$ ]]; then - if [[ -n $(find $FILE -type f -exec egrep -l " +$" {} \;) ]]; then + if [[ -n $(grep -E ' $' $FILE) ]]; then echo -e "\e[1;31m\tFound whitespace at end of line.\e[0m" >&2 + echo grep -E ' $' $FILE >&2 exit 1 fi fi