Skip to content

Instantly share code, notes, and snippets.

@seanmccann
Created January 27, 2009 07:24
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save seanmccann/53225 to your computer and use it in GitHub Desktop.
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
# 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
@nonfu
Copy link

nonfu commented Apr 10, 2018

${i##*.} == php should be ${i##*.} = php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment