[PATCH 7 of 7] test: add a basic 'test-check-pylint.t'

Sean Farley sean at farley.io
Wed Mar 22 01:19:29 EDT 2017


Pierre-Yves David <pierre-yves.david at ens-lyon.org> writes:

> On 03/15/2017 10:13 AM, Kevin Bullock wrote:
>>> On Mar 15, 2017, at 11:35, Gregory Szorc <gregory.szorc at gmail.com> wrote:
>>>
>>> On Mar 15, 2017, at 07:56, Kevin Bullock <kbullock+mercurial at ringworld.org> wrote:
>>>
>>>>> On Mar 15, 2017, at 02:01, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:
>>>>>
>>>>> # HG changeset patch
>>>>> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
>>>>> # Date 1482964970 -3600
>>>>> #      Wed Dec 28 23:42:50 2016 +0100
>>>>> # Node ID e1b0b1909c43858ff4b4e1821afbee9626c4cf0f
>>>>> # Parent  b24451e8f9a6beee5501e9bedc47af7edc283ea4
>>>>> # EXP-Topic check-pylint
>>>>> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
>>>>> #              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r e1b0b1909c43
>>>>> test: add a basic 'test-check-pylint.t'
>>>>>
>>>>> We add a minimal check using pylint for one case we knows we care about:
>>>>> "mutable default" argument.
>>>>>
>>>>> We'll likely extend this over time to cover other useful checks but this is a
>>>>> good starting point.
>>>>
>>>> I had to dig a bit to convince myself that pyflakes, which we already integrated, won't catch this. It indeed will not, so this LGTM. Copy-edited the new test and pushed.
>>>
>>> We may want to look into flake8. It wraps the popular linters in a single interface and is quite nice.
>>>
>>> The downside for our use case is that output will be different unless all the linters it wraps are present.
>>
>> Will flake8 also run pylint? I thought it was only pep8 + pyflakes.
>>
>> There are also a number of ways our style differs from PEP8, so that piece in particular wouldn't get us much over this one, where we now have both test-check-pyflakes.t and test-check-pylint.t. Worth considering, though, in the (very likely) case others know more than I do about flake8's capabilities.
>
> flake8 is run on the evolve extension (I think credit goes to Sean for 
> the initial idea). Our style is quite far away from PEP8 so I've 
> disabled a fair amount of message, but it still catch many useful thing.
>
> * evolve flake8 tests: 
> https://www.mercurial-scm.org/repo/evolve/file/tip/tests/test-check-flake8.t
>
> * evolve flake8 config: 
> https://www.mercurial-scm.org/repo/evolve/file/tip/setup.cfg

Yep! I was planning on adding some config to core Mercurial one day. I
*think* one config file can be used for pylint + flake8. It's low on my
priority list, though, so don't hold your breath. Also, it's fairly
straight-forward so maybe a new student could tackle this?


More information about the Mercurial-devel mailing list