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,18 +1,27 @@
#!/bin/bash #!/bin/bash
PHP_BINARY="php" PHP_BINARY="php"
DIR=""
while getopts "p:" OPTION 2> /dev/null; do while getopts "p:d:" OPTION 2> /dev/null; do
case ${OPTION} in case ${OPTION} in
p) p)
PHP_BINARY="$OPTARG" PHP_BINARY="$OPTARG"
;; ;;
d)
DIR="$OPTARG"
;;
esac esac
done 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 if [ $? -ne 0 ]; then
echo $OUTPUT | grep -v "No syntax errors" echo $OUTPUT | grep -v "No syntax errors"

View File

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