Skip to content

Instantly share code, notes, and snippets.

@hkage
Created January 25, 2018 11:21
Show Gist options
  • Save hkage/6365d129c5c39794be8932f070a06054 to your computer and use it in GitHub Desktop.
Save hkage/6365d129c5c39794be8932f070a06054 to your computer and use it in GitHub Desktop.
Bash command to make a flake8 check for lokal git changes
#!/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