Created
August 6, 2014 01:23
-
-
Save markkelnar/ebc2f147ce70116991b2 to your computer and use it in GitHub Desktop.
PHP lint checker - pre commit 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 | |
# Put this file in .git/hooks/pre-commit | |
# Change it to be executable! If you don't do this, it won't work | |
# chmod +x .git/hooks/pre-commit | |
git diff-index --diff-filter=ACMR --name-only --cached HEAD | | |
grep '.php$' | | |
xargs -tn1 php -l | |
if (( $? )); then | |
echo Upon commit, PHP lint check failed, you fool! | |
exit 1 | |
fi | |
#GREEN MEANS GO | |
echo -e PASSED |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment