Created
December 10, 2012 01:47
-
-
Save danlamanna/4247925 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# skip returns of "No syntax errors..." or "Errors parsing... " | |
linterrors=$((find wp-content/themes wp-content/mu-plugins -type f -name "*.php" -exec php -l {} \; | egrep -v "^(No|Errors)") 2>&1) | |
if [ "$linterrors" != "" ]; then | |
echo "[PRE-COMMIT-ERROR]: Failed PHP Lint Check." | |
echo "---------------------------------------------" | |
echo $linterrors | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Needs to be altered to only check altered files per commit, to avoid linting files that haven't changed. See: http://tech.yipit.com/2011/11/16/183772396/