Fix new hooks

This commit is contained in:
Dennis Eichhorn 2018-08-11 11:58:43 +02:00
parent d8750c90dd
commit f56dd74de6
2 changed files with 4 additions and 5 deletions

View File

@ -64,11 +64,13 @@ git diff --cached --name-only | while read FILE; do
fi fi
if [[ "$FILE" =~ ^.+(sh|js|php|json|css)$ ]]; then if [[ "$FILE" =~ ^.+(sh|js|php|json|css)$ ]]; then
echo 0
echo $FILE
echo 1 echo 1
GEN_SYNTAX=$(hasInvalidBasicSyntax "$FILE") GEN_SYNTAX=$(hasInvalidBasicSyntax "$FILE")
echo 2 echo 2
if [[ $GEN_SYNTAX = 1 ]]; then if [[ $GEN_SYNTAX = 1 ]]; then
echo -e "\e[1;31m\tFound whitespace at end of line in $FILE.\e[0m" >&2 echo -e "\e[1;31m\tFound whitespace at end of line in $FILE.\e[0m" >&2
grep -P ' $' $FILE >&2 grep -P ' $' $FILE >&2

View File

@ -71,10 +71,7 @@ isValidBashScript() {
} }
hasInvalidBasicSyntax() { hasInvalidBasicSyntax() {
# Check whitespace end of line in code
if [[ -n $(grep -P ' $' "$1") ]]; then
return 1
fi
# Check for tabs # Check for tabs
if [[ -n $(grep -P '\t' "$1") ]]; then if [[ -n $(grep -P '\t' "$1") ]]; then