Last active
December 21, 2016 16:32
-
-
Save jc1987/a92f2be3d95da91d26ea7f2cb017a183 to your computer and use it in GitHub Desktop.
precommit cs
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
#!/usr/bin/env bash | |
echo "pre commit hook start phpcs" | |
CURRENT_DIRECTORY=`pwd` | |
GIT_HOOKS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
PROJECT_DIRECTORY="$GIT_HOOKS_DIR/../.." | |
cd $PROJECT_DIRECTORY; | |
PHP_CS_FIXER="php php-cs-fixer.phar" | |
git status -s | cut -c4- | grep -e '\(.*\).php$' |while read line; do | |
${PHP_CS_FIXER} fix --dry-run --diff --level=symfony --verbose ${line}; | |
done | |
cd $CURRENT_DIRECTORY; | |
echo "pre commit hook finish phpcs" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment