Require both braces on else statement line

This commit is contained in:
Zach Borboa
2016-08-19 00:25:23 -07:00
parent 400cf8b0a2
commit 18b5ad7e78
+7
View File
@@ -101,4 +101,11 @@ if [[ ! -z "${elseif}" ]]; then
((errors++))
fi
# Require both braces on else statement line; "} else {" and not "}\nelse {".
elses=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec grep --color=always --line-number -H --perl-regexp '^(\s+)?else(\s+)?{' {} \;)
if [[ ! -z "${elses}" ]]; then
echo -e "${elses}" | perl -pe 's/^(.*)$/Found newline before "else" statement in \1/'
((errors++))
fi
exit "${errors}"