From f56dd74de6b54192579aef8a94fe22033d7a38e4 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 11 Aug 2018 11:58:43 +0200 Subject: [PATCH] Fix new hooks --- Hooks/delegator.sh | 4 +++- Hooks/syntax.sh | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Hooks/delegator.sh b/Hooks/delegator.sh index 09a7305..be3d511 100644 --- a/Hooks/delegator.sh +++ b/Hooks/delegator.sh @@ -64,11 +64,13 @@ git diff --cached --name-only | while read FILE; do fi if [[ "$FILE" =~ ^.+(sh|js|php|json|css)$ ]]; then + echo 0 + echo $FILE echo 1 GEN_SYNTAX=$(hasInvalidBasicSyntax "$FILE") - echo 2 + if [[ $GEN_SYNTAX = 1 ]]; then echo -e "\e[1;31m\tFound whitespace at end of line in $FILE.\e[0m" >&2 grep -P ' $' $FILE >&2 diff --git a/Hooks/syntax.sh b/Hooks/syntax.sh index 097ae09..8274562 100644 --- a/Hooks/syntax.sh +++ b/Hooks/syntax.sh @@ -71,10 +71,7 @@ isValidBashScript() { } hasInvalidBasicSyntax() { - # Check whitespace end of line in code - if [[ -n $(grep -P ' $' "$1") ]]; then - return 1 - fi + # Check for tabs if [[ -n $(grep -P '\t' "$1") ]]; then