Created
April 21, 2016 16:49
-
-
Save jsenin/d126e95375345633ac69bca90e88e089 to your computer and use it in GitHub Desktop.
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 | |
# file: .git/hooks/pre-commit | |
# | |
# phpcs needed | |
# apt-get install php-codesniffer | |
while read -r file; | |
do | |
file=${file:2} | |
if [[ $file = *.php ]]; | |
then | |
phpcs --standard=psr2 "$file" | |
if [ $? -ne 0 ]; then | |
echo "PSR2 not passed" | |
exit 1 ; | |
fi; | |
fi | |
done < <(git diff --cached --name-status --diff-filter=ACM) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment