Symbol white

← Back to other Codebase suggestions

Subversion pre-commit hook

624b0121d9827a1e7f6f9f92756abde6?rating=pg&size=52&default=mm
suggested by Mark R
1

I would like to run some lint checks before my code is commited. This prevents syntactically code to get in the repository.

Example for PHP:

REPOS="$1"
TXN="$2"
SVNLOOK=/usr/bin/svnlook
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/php -d html_errors=off -l || echo $i`
RETURN=`echo $CHECK | /bin/grep -q "^No syntax" && echo TRUE || echo FALSE`
if [ $RETURN = 'FALSE' ]; then
echo $CHECK 1>&2;
exit 1
fi
fi
done

Collecting We're collecting votes & feedback about this suggestion!

Login to comment on this suggestion