Created
September 28, 2013 13:21
-
-
Save trq/6742011 to your computer and use it in GitHub Desktop.
php lint git-hook
This file contains 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
#!/bin/bash | |
git diff --cached --name-status --diff-filter=ACMR | while read STATUS FILE; do | |
if [[ "$FILE" =~ ^.+(php|inc)$ ]]; then | |
php -l "$FILE" 1> /dev/null | |
if [ $? -ne 0 ]; then | |
echo "Aborting commit due to files with syntax errors" >&2 | |
exit 1 | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment