[Biopython-dev] Further PEP8 Cleanup

Christian Brueffer christian at brueffer.de
Thu Dec 6 06:22:24 UTC 2012


On 12/06/2012 12:04 PM, Christian Brueffer wrote:
> 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.
>

Thinking about it, I think it would make sense to ignore the following:

E121 continuation line indentation is not a multiple of four
E122 continuation line missing indentation or outdented
E123 closing bracket does not match indentation of opening bracket's line
E124 closing bracket does not match visual indentation
E126 continuation line over-indented for hanging indent
E127 continuation line over-indented for visual indent
E128 continuation line under-indented for visual indent

They all deal with indentation, but are not always beneficial to
readability.  E125 is missing from that list, which is a useful one.

Chris



More information about the Biopython-dev mailing list