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
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.
# Post-commit hook for FreeIPA
if git rev-parse --verify HEAD~ >/dev/null 2>&1
# Initial commit: diff against an empty tree object
FILES=`git diff --cached --name-only $against | grep '\.py$'`
if [ -n "$FILES" ]; then
echo Commit `git rev-parse --verify HEAD`: Linting...
pep8 $FILES -r
Freeipa-devel mailing list