Skip to content

Instantly share code, notes, and snippets.

@newgene
Last active August 29, 2015 14:26
Show Gist options
  • Save newgene/9c1ba415a18821b00977 to your computer and use it in GitHub Desktop.
Save newgene/9c1ba415a18821b00977 to your computer and use it in GitHub Desktop.
My handy shell aliases for checking all changed Python files under a git or mercurial repo before commit.
# Just a short-hand to type less
alias f8='flake8'
# run "hgf" anywhere in a mercurial repo, it will check all changed *.py with flake8
alias hgf='tmp_cwd=`pwd` ; cd `hg root`; hgs -nmd |grep "\.py$" |xargs flake8; cd $tmp_cwd; unset tmp_cwd'
# run "gf" anywhere in a git repo, it will check all changed *.py with flake8
alias gf='tmp_cwd=`pwd` ; cd `git rev-parse --show-toplevel`; git diff --name-only |grep "\.py$" |xargs flake8; cd $tmp_cwd; unset tmp_cwd'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment