[Biopython-dev] git pre-commit hook for PEP8 style checking

Christian Brueffer christian at brueffer.de
Mon Oct 20 10:32:38 UTC 2014


Hi everyone,

TL;DR: lots of style problems in biopython code, please consider using 
the git pre-commit hook at https://github.com/cbrueffer/pep8-git-hook 
(or check your files manually with the pep8 utility).


Long version:

Since the last round of PEP8 fixes to the biopython repo almost two 
years ago, many classes of inconsistencies have unfortunately slowly 
crept back in.

One way to check the code you're committing is via a git pre-commit 
hook, which tells you which kinds of problems your submissions contain.

Such a commit hook can be found here:

https://github.com/cbrueffer/pep8-git-hook

Installation is easy, simply copy the pre-commit file from the above 
repository into the following directory in your biopython checkout: 
.git/hooks
You also need the pep8 utility (pip install pep8).

A list of problem classes pep8 reports can be found here:
http://pep8.readthedocs.org/en/latest/intro.html#error-codes

By default the hook checks for all of these problems, except the 
following ones: E121-E129, E131, and E501 (indentation and long lines).

The way it works is, the hook stops your commit and tells you which 
issues your code contains.  The hook won't bother you if the files in 
the commit contain no issues, or you commit with --no-verify (e.g., git 
commit -a --no-verify).  The latter is especially for situations where 
your code is fine, but files contain pre-existing issues.

Please test this and let me know what you think, whether the list of 
issues should be adapted etc.  Continuous checking would improve our 
code consistency a lot in the long run.

Cheers,

Chris


More information about the Biopython-dev mailing list