Created
January 27, 2009 07:24
-
-
Save seanmccann/53225 to your computer and use it in GitHub Desktop.
PHP lint checker -- use in svn pre-commit hook. This prevents code with basic parse errors from entering the repository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# originally from Joe Stump at Digg | |
for i in `$SVNLOOK changed -t "$TXN" "$REPOS" | /usr/bin/awk '{print $2}'` | |
do | |
if [ ${i##*.} == php ]; then | |
CHECK=`$SVNLOOK cat -t "$TXN" "$REPOS" $i | /usr/bin/php5 -d html_errors=off -l || echo $i` | |
RETURN=`echo $CHECK | /bin/grep "^No syntax" > /dev/null && echo TRUE || echo FALSE` | |
if [ $RETURN = 'FALSE' ]; then | |
echo $CHECK 1>&2; | |
exit 1 | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
${i##*.} == php
should be${i##*.} = php