[Biopython-dev] Further PEP8 Cleanup

Christian Brueffer christian at brueffer.de
Thu Dec 6 04:04:37 UTC 2012


On 12/05/2012 11:28 PM, Christian Brueffer wrote:
> On 12/5/12 22:16 , Peter Cock wrote:
[...]
>
>>>> You've got us a lot closer to PEP8 compliance - do you think
>>>> subject to a short white list of known cases (like module
>>>> names) where we don't follow PEP8 we could aim to run a
>>>> a pep8 tool automatically (e.g. as a unit test, or even a commit
>>>> hook)? That is quite appealing as a way to spot any new code
>>>> which breaks the style guidelines...
>>>
>>> Having a commit hook would be ideal (maybe with a possibility to
>>> override).  This would be especially useful against the introduction of
>>> gratuitous whitespace.  With some editors/IDEs you don't even notice it.
>>
>> Would you be interested in looking into how to set that up?
>> Presumably a client-side git hook would be best, but we'd
>> need to explore cross platform issues (e.g. developing and
>> testing on Windows) and making sure it allowed an override
>> on demand (where the developer wants/needs to ignore a
>> style warning).
>>
>
> Yes, It's fairly high on my TODO list.
>

I just had a look at this.  Turns out some people have had this idea
before :-)

Here's a first version:

https://github.com/cbrueffer/pep8-git-hook/blob/master/pre-commit

Basically you just save this as biopython/.git/hooks/pre-commit and mark
it executable.  You also need to install pep8 (pip install pep8).  The 
checks can be bypassed with git commit --no-verify.

Currently it ignores E124 (which I think should remain that way).  Any 
other errors or files it should ignore?

I'd be grateful if someone could give this a try on Windows.

Chris



More information about the Biopython-dev mailing list