Dylan K. Taylor d75c830a7e Add -f parameter to lint.sh to allow it to not be useless in cygwin
find can conflict with windows' built in find command, which causes it to bug out when running tests.
2018-10-05 17:43:45 +01:00

36 lines
546 B
Bash
Executable File

#!/bin/bash
PHP_BINARY="php"
DIR=""
FIND="find"
while getopts "p:d:f:" OPTION 2> /dev/null; do
case ${OPTION} in
p)
PHP_BINARY="$OPTARG"
;;
d)
DIR="$OPTARG"
;;
f)
FIND="$OPTARG"
;;
esac
done
if [ "$DIR" == "" ]; then
echo No directory specified
exit 1
fi
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.