Fix function return check

This commit is contained in:
Dennis Eichhorn 2018-08-11 12:23:16 +02:00
parent bd2226e822
commit 1cbd330521
2 changed files with 14 additions and 9 deletions

View File

@ -38,7 +38,8 @@ git diff --cached --name-only | while read FILE; do
# Syntax
if [[ "$FILE" =~ ^.+(php)$ ]]; then
PHP_SYNTAX=$(hasInvalidPhpSyntax "$FILE")
$(hasInvalidPhpSyntax "$FILE")
PHP_SYNTAX=$?
if [[ $PHP_SYNTAX = 1 ]]; then
echo -e "\e[1;31m\tPhp linting error.\e[0m" >&2
@ -62,8 +63,8 @@ git diff --cached --name-only | while read FILE; do
fi
if [[ "$FILE" =~ ^.+(sh|js|php|json|css)$ ]]; then
GEN_SYNTAX=$(hasInvalidBasicSyntax "$FILE")
echo $GEN_SYNTAX
$(hasInvalidBasicSyntax "$FILE")
GEN_SYNTAX=$?
if [[ $GEN_SYNTAX = 1 ]]; then
echo -e "\e[1;31m\tFound whitespace at end of line in $FILE.\e[0m" >&2
@ -79,7 +80,8 @@ git diff --cached --name-only | while read FILE; do
fi
if [[ "$FILE" =~ ^.+(tpl\.php|html)$ ]]; then
TPL_SYNTAX=$(hasInvalidHtmlTemplateContent "$FILE")
$(hasInvalidHtmlTemplateContent "$FILE")
TPL_SYNTAX=$?
if [[ $TPL_SYNTAX = 1 ]]; then
echo -e "\e[1;31m\tFound missing image alt attribute.\e[0m" >&2

View File

@ -41,7 +41,8 @@ echo $rootpath
# Syntax
if [[ "$FILE" =~ ^.+(php)$ ]]; then
PHP_SYNTAX=$(hasInvalidPhpSyntax "$FILE")
$(hasInvalidPhpSyntax "$FILE")
PHP_SYNTAX=$?
if [[ $PHP_SYNTAX = 1 ]]; then
echo -e "\e[1;31m\tPhp linting error.\e[0m" >&2
@ -65,7 +66,8 @@ echo $rootpath
fi
if [[ "$FILE" =~ ^.+(sh|js|php|json|css)$ ]]; then
GEN_SYNTAX=$(hasInvalidBasicSyntax "$FILE")
$(hasInvalidBasicSyntax "$FILE")
GEN_SYNTAX=$?
if [[ $GEN_SYNTAX = 1 ]]; then
echo -e "\e[1;31m\tFound whitespace at end of line in $FILE.\e[0m" >&2
@ -81,7 +83,8 @@ echo $rootpath
fi
if [[ "$FILE" =~ ^.+(tpl\.php|html)$ ]]; then
TPL_SYNTAX=$(hasInvalidHtmlTemplateContent "$FILE")
$(hasInvalidHtmlTemplateContent "$FILE")
TPL_SYNTAX=$?
if [[ $TPL_SYNTAX = 1 ]]; then
echo -e "\e[1;31m\tFound missing image alt attribute.\e[0m" >&2