From f03d879a9fa08344aa4b8c5bd1ad9572e9d23dc5 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 12 Jul 2018 20:44:42 +0200 Subject: [PATCH] Added find whitepsace check --- Hooks/syntax.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Hooks/syntax.sh b/Hooks/syntax.sh index d7b4263..bb8b6f6 100644 --- a/Hooks/syntax.sh +++ b/Hooks/syntax.sh @@ -10,14 +10,14 @@ if [[ "$FILE" =~ ^.+(php)$ ]]; then echo -e "\e[1;31m\tPhp linting error.\e[0m" >&2 exit 1 fi - + # phpcs ${rootpath}/vendor/bin/phpcs --standard="${rootpath}/Build/Config/phpcs.xml" --encoding=utf-8 -n -p $FILE if [ $? -ne 0 ]; then echo -e "\e[1;31m\tCode Sniffer error.\e[0m" >&2 exit 1 fi - + # phpmd ${rootpath}/vendor/bin/phpmd $FILE text ${rootpath}/Build/Config/phpmd.xml --exclude *tests* --minimumpriority 1 if [ $? -ne 0 ]; then @@ -38,4 +38,10 @@ if [[ "$FILE" =~ ^.+(sh)$ ]]; then fi fi +# Check whitespace end of line +if [[ -n $(find $FILE -type f -exec egrep -l " +$" {} \;) ]]; then + echo -e "\e[1;31m\tFound whitespace at end of line.\e[0m" >&2 + exit 1 +fi + done || exit $?