db2html: remove text handling for some tags
[gtk-doc.git] / tools / git-pre-commit
blobc0bf531b32d74ec5a87cfb86d937cb438fa3339b
1 #!/bin/sh
2 # git hook to ensure code style
3 # cp tools/git-pre-commit .git/hooks/pre-commit
5 # TODO:
6 # pylint -r n -f parseable $files
8 which >/dev/null pep8 || (echo "please install pep8"; exit )
9 which >/dev/null autopep8 || (echo "please install autopep8"; exit )
10 which >/dev/null pyflakes || (echo "please install pyflakes"; exit )
12 files=$(git diff --name-only --staged --diff-filter=ACMRTUXB | egrep "*.py$")
14 if test -n "$files"; then
15 pep8 --max-line-length=120 $files
16 res=$?
17 if [ $res -ne 0 ]; then
18 echo
19 autopep8 --max-line-length=120 --diff $files
20 echo
21 echo "To fix run: autopep8 --max-line-length=120 -i $files"
22 else
23 pyflakes $files
24 res=$?
26 exit $res