2 # git hook to ensure code style
3 # cp tools/git-pre-commit .git/hooks/pre-commit
5 which >/dev
/null pep8 ||
(echo "please install pep8"; exit )
6 files
=$
(git
diff --name-only --staged --diff-filter=ACMRTUXB |
egrep "*.py$")
8 if test -n "$files"; then
9 pep8
--max-line-length=120 $files
11 if [ $res -ne 0 ]; then
13 autopep8
--max-line-length=120 --diff $files
15 echo "To fix run: autopep8 --max-line-length=120 -i $files"