mirror of
https://github.com/Karaka-Management/Build.git
synced 2026-02-08 23:58:39 +00:00
Output file in case of error
This commit is contained in:
parent
ef0f01877d
commit
25af3c80fd
|
|
@ -5,7 +5,7 @@ git diff --cached --name-only | while read FILE; do
|
||||||
if [[ "$FILE" =~ ^.+(php)$ ]]; then
|
if [[ "$FILE" =~ ^.+(php)$ ]]; then
|
||||||
if [[ -f $FILE ]]; then
|
if [[ -f $FILE ]]; then
|
||||||
# php lint
|
# php lint
|
||||||
php -l "$FILE" 1> /dev/null
|
php -l "$FILE"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo -e "\e[1;31m\tPhp linting error.\e[0m" >&2
|
echo -e "\e[1;31m\tPhp linting error.\e[0m" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -105,14 +105,14 @@ fi
|
||||||
if [[ "$FILE" =~ ^.+(sh|js|php|json|css)$ ]]; then
|
if [[ "$FILE" =~ ^.+(sh|js|php|json|css)$ ]]; then
|
||||||
# Check whitespace end of line in code
|
# Check whitespace end of line in code
|
||||||
if [[ -n $(grep -P ' $' $FILE) ]]; then
|
if [[ -n $(grep -P ' $' $FILE) ]]; then
|
||||||
echo -e "\e[1;31m\tFound whitespace at end of line.\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
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for tabs
|
# Check for tabs
|
||||||
if [[ -n $(grep -P '\t' $FILE) ]]; then
|
if [[ -n $(grep -P '\t' $FILE) ]]; then
|
||||||
echo -e "\e[1;31m\tFound tab instead of whitespace.\e[0m" >&2
|
echo -e "\e[1;31m\tFound tab instead of whitespace $FILE.\e[0m" >&2
|
||||||
grep -P '\t' $FILE >&2
|
grep -P '\t' $FILE >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user