Last active
May 17, 2018 16:01
-
-
Save awestendorf/47c169bc48ade77cb5e6 to your computer and use it in GitHub Desktop.
Run flake8 on the set of changes in a pre-commit hook
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 | |
# Place in .git/hooks/pre-commit | |
# Filters out deleted files with --diff-filter | |
# GNU | |
git diff --cached --name-only --diff-filter=ACMRTUXB | grep .py | xargs --no-run-if-empty flake8 $FLAKE | |
# BSD | |
git diff --cached --name-only --diff-filter=ACMRTUXB | (grep .py || echo " ") | xargs flake8 $FLAKE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To ignore all errors when committing: