Created
January 25, 2018 11:21
-
-
Save hkage/6365d129c5c39794be8932f070a06054 to your computer and use it in GitHub Desktop.
Bash command to make a flake8 check for lokal git changes
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 | |
if [[ ! -d .git ]]; then | |
echo "This command must be run from the root directory of a git repository." | |
exit 1 | |
fi | |
COMPARE_BRANCH="${1:-development}" | |
echo "Checking files that have changed between current branch and $COMPARE_BRANCH:" | |
git diff --name-only $COMPARE_BRANCH | grep '.*\.py' | xargs flake8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment