Pull out tests from syntax checks

This commit is contained in:
Dennis Eichhorn 2018-07-12 20:03:48 +02:00
parent 62d7423d96
commit 8161fa9611
3 changed files with 23 additions and 13 deletions

View File

@ -2,4 +2,5 @@
. ${rootpath}/Build/Hooks/logging.sh
. ${rootpath}/Build/Hooks/syntax.sh
. ${rootpath}/Build/Hooks/filename.sh
. ${rootpath}/Build/Hooks/filename.sh
. ${rootpath}/Build/Hooks/tests.sh

View File

@ -24,18 +24,6 @@ if [[ "$FILE" =~ ^.+(php)$ ]]; then
echo -e "\e[1;31m\tMess Detector error.\e[0m" >&2
exit 1
fi
# phan
${rootpath}/vendor/bin/phan -k ${rootpath}/Build/Config/phan.php -f $FILE
if [ $? -ne 0 ]; then
echo -e "\e[1;31m\tPhan warning.\e[0m" >&2
fi
# phpstan
php -d memory_limit=4G ${rootpath}/vendor/bin/phpstan analyse --autoload-file=${rootpath}/phpOMS/Autoloader.php -l 7 -c ${rootpath}/Build/Config/phpstan.neon $FILE
if [ $? -ne 0 ]; then
echo -e "\e[1;31m\tPhp stan warning.\e[0m" >&2
fi
fi
fi

21
Hooks/tests.sh Normal file
View File

@ -0,0 +1,21 @@
#!/bin/bash
git diff --cached --name-only | while read FILE; do
if [[ "$FILE" =~ ^.+(php)$ ]]; then
if [[ -f $FILE ]]; then
# phan
${rootpath}/vendor/bin/phan -k ${rootpath}/Build/Config/phan.php -f $FILE
if [ $? -ne 0 ]; then
echo -e "\e[1;31m\tPhan warning.\e[0m" >&2
fi
# phpstan
php -d memory_limit=4G ${rootpath}/vendor/bin/phpstan analyse --autoload-file=${rootpath}/phpOMS/Autoloader.php -l 7 -c ${rootpath}/Build/Config/phpstan.neon $FILE
if [ $? -ne 0 ]; then
echo -e "\e[1;31m\tPhp stan warning.\e[0m" >&2
fi
fi
fi
done || exit $?