Tests: Make lint.sh a little more useful

This commit is contained in:
Dylan K. Taylor 2018-02-12 11:34:51 +00:00
parent b7bd8dc7f1
commit 6e7a693355
2 changed files with 14 additions and 5 deletions

View File

@ -1,22 +1,31 @@
#!/bin/bash
PHP_BINARY="php"
DIR=""
while getopts "p:" OPTION 2> /dev/null; do
while getopts "p:d:" OPTION 2> /dev/null; do
case ${OPTION} in
p)
PHP_BINARY="$OPTARG"
;;
d)
DIR="$OPTARG"
;;
esac
done
echo Running PHP lint scans...
if [ "$DIR" == "" ]; then
echo No directory specified
exit 1
fi
OUTPUT=`find ./src/pocketmine -name "*.php" -print0 | xargs -0 -n1 -P4 "$PHP_BINARY" -l`
echo Running PHP lint scans on \"$DIR\"...
OUTPUT=`find "$DIR" -name "*.php" -print0 | xargs -0 -n1 -P4 "$PHP_BINARY" -l`
if [ $? -ne 0 ]; then
echo $OUTPUT | grep -v "No syntax errors"
exit 1
fi
echo Lint scan completed successfully.
echo Lint scan completed successfully.

View File

@ -10,7 +10,7 @@ while getopts "p:" OPTION 2> /dev/null; do
esac
done
./tests/lint.sh -p "$PHP_BINARY"
./tests/lint.sh -p "$PHP_BINARY" -d ./src/pocketmine
if [ $? -ne 0 ]; then
echo Lint scan failed!