Created
April 2, 2015 17:08
-
-
Save dantoncancella/a9a89b799c9c9594fa0c to your computer and use it in GitHub Desktop.
Simple Code Sniffer pre-commit hook
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/sh | |
PHPFILES=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep .php` | |
# verifica CodeSniffer PHP | |
if [ "$PHPFILES" != "" ] | |
then | |
# verifica arquivos PHP | |
echo "Executando Code Sniffer..." | |
./bin/phpcs --warning-severity=0 --standard=PSR2 --encoding=utf-8 -p $PHPFILES | |
if [ $? != 0 ] | |
then | |
echo "Corrija os erros antes de enviar os arquivos para o servidor." | |
exit 1 | |
fi | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment