Hook for tox compliancy before a git-review

When Pep8 meets 300...

Shamely copied from OpenstackReactions http://openstackreactions.enovance.com/2014/03/paeeeep8/

Everyone can do mistakes, in particular when under pressure one do a quick change-and-push patchset to Gerrit without checking PEP8 compliancy… How many times Jenkins gives -1 to a patch because of PEP8 check failing ?

The  solution is to add a git hook on a commit for checking PEP8 compliancy. I personnally prefer running the check *before* submitting the patch, that’s another option.

Nothing original here : create a Python script located in <your_project>/.git/hooks, name it pre-review, make it executable and fill it with :

#!/usr/bin/env python
import tox

tox.cmdline(['-e', 'pep8'])

Hope it will help.