[PATCH 01 of 10] check-code: add AST check for mutable default argument values

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Jan 4 13:51:53 EST 2017



On 01/04/2017 04:59 PM, Augie Fackler wrote:
>
>> On Jan 4, 2017, at 10:14 AM, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:
>>
>>>> Can you have a look in that other tools and tell us what you find?
>>>
>>> I know pylint can do this, but configuring pylint is a bit fussy.
>>
>> I scanned quickly through the pylint help and got something up under two minutes. The small call below fits our needs regarding mutable default arg:
>>
>>  pylint --disable=all --enable=W0102 --reports=no mercurial hgext …
>>
>> I'll provide Greg with a .t version of that for his series.
>>
>> Please try to avoid making unchecked negative statement about other people softwares.
>
> It seems you’ve misinterpreted what I meant when I said “a bit fussy”, so I’m going to clarify:
>
> pylint is, from my own long-standing (almost a decade!) experience with the tool, tedious to configure. The fact that you did this in under two minutes means you’re far more familiar with configuration of pylint than I am.

hu? I've actually barely used pylint in my life, even less configured it.

I literally got the pylint¹ lead from a random blog post found at the 
top of google://"python automated check mutable argument", 
apt-get-installed pylint and scanned the man page over one screen to 
find the "MESSAGES CONTROL" section. Tried its content and got pylint to 
provides the right result in about two tries. Nothing more advanced than 
that.

Cheers,

-- 
Pierre-Yves David

[1] I knew pylint existed, but I wasn't sure what tools was the best for 
this.


More information about the Mercurial-devel mailing list