Let me share my post-commit hook with you.
Save this as .git/hooks/post-commit, chmod +x it, and each time you make
a commit, it will run pylint and a PEP8 check on all .py files you've
changed.
It takes a long time, but it runs after the commit is made, so you can
quite safely kill it or switch to a different terminal and continue working.
It's also quite noisy -- IPA doesn't really conform to its style guide,
mainly because there are lots of long lines. I always like to check
around the changes I made for little style fixes to sneak into my patch.
yum install python-pep8 for the style checks.
Improvements welcome!
--
PetrĀ³
#!/bin/sh
#
# Post-commit hook for FreeIPA
if git rev-parse --verify HEAD~ >/dev/null 2>&1
then
against=HEAD~
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
FILES=`git diff --cached --name-only $against | grep '\.py$'`
echo $FILES
if [ -n "$FILES" ]; then
echo Commit `git rev-parse --verify HEAD`: Linting...
./make-lint $FILES
pep8 $FILES -r
fi
_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel