Add PHP lint and PHP code sniffer

This commit is contained in:
Tautvidas Sipavičius
2016-06-29 16:19:50 +03:00
parent 18326f9df1
commit 805e641d40
6 changed files with 615 additions and 11 deletions

31
tasks/php_lint.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
error=false
while test $# -gt 0; do
current=$1
shift
if [ ! -d $current ] && [ ! -f $current ] ; then
echo "Invalid directory or file: $current"
error=true
continue
fi
for file in `find $current -type f -name "*.php"` ; do
RESULTS=`php -l $file`
if [ "$RESULTS" != "No syntax errors detected in $file" ] ; then
echo $RESULTS
error=true
fi
done
done
if [ "$error" = true ] ; then
exit 1
else
exit 0
fi