mirror of
https://github.com/Karaka-Management/Build.git
synced 2026-02-13 17:48:39 +00:00
Update syntax.sh
This commit is contained in:
parent
87d605aaab
commit
2459f480f3
|
|
@ -1,12 +1,29 @@
|
||||||
git diff --cached --name-only | while read FILE; do
|
git diff --cached --name-only | while read FILE; do
|
||||||
|
|
||||||
if [[ "$FILE" =~ ^.+(php|inc|module|install|test)$ ]]; then
|
if [[ "$FILE" =~ ^.+(php|inc|module|install|test)$ ]]; then
|
||||||
# Courtesy of swytsh from the comments below.
|
|
||||||
if [[ -f $FILE ]]; then
|
if [[ -f $FILE ]]; then
|
||||||
|
|
||||||
|
# php lint
|
||||||
php -l "$FILE" 1> /dev/null
|
php -l "$FILE" 1> /dev/null
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo -e "\e[1;31m\tAborting commit due to files with syntax errors.\e[0m" >&2
|
echo -e "\e[1;31m\tPhp linting error.\e[0m" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# phpcs
|
||||||
|
./vendor/bin/phpcs --standard="./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
|
||||||
|
./vendor/bin/phpmd --standard="./Build/Config/phpmd.xml" --encoding=utf-8 -n -p $FILE
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo -e "\e[1;31m\tMess Detector error.\e[0m" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done || exit $?
|
done || exit $?
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user