Created
October 25, 2017 14:19
-
-
Save Zayon/07c2beba7f0dcefb2e46d036a77df8db to your computer and use it in GitHub Desktop.
pre-commit php-cs-fixer
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 | |
ROOT=$(git rev-parse --show-toplevel) | |
cd "$ROOT" | |
git --git-dir "$ROOT"/.git --work-tree "$ROOT" status --porcelain | grep -e '^[AM]\(.*\).php$' | cut -c 3- | while read line; do | |
bin/php-cs-fixer fix --dry-run --diff --no-ansi --verbose "$line" | |
if [ $? -ne 0 ]; then | |
exit 1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment