Created
September 8, 2016 15:03
-
-
Save friek/f78e154060b2a141b9320a57c92ff31e to your computer and use it in GitHub Desktop.
Run a php lint check on all php files which are to be committed
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 | |
if git rev-parse --verify HEAD >/dev/null 2>&1 | |
then | |
against=HEAD | |
else | |
exit 0 | |
fi | |
set -e | |
IFS="\n" \ | |
git diff --name-only HEAD | \ | |
while read fn; do | |
if [[ "$fn" == *".php" ]]; then | |
if [ -f "$fn" ]; then | |
php -l "$fn" | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment