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

Augie Fackler raf at durin42.com
Wed Dec 28 12:43:25 EST 2016


> On Dec 27, 2016, at 4:57 AM, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:
> 
>> This patch introduces a check-code check for the sanity of
>> default argument values. It does so by parsing and walking the
>> AST. Previously, all check-code checks were implemented as
>> regular expressions. I probably could have implemented the check
>> with regular expressions. However, AST based checks are more robust
>> and arguably easier to implement for complex patterns (such as
>> function argument lists).
> 
> I'm a bit worried at check-code growing too big. There is probably existing python analysis tool to catch this kind of error. (eg: I'm prtty sure pylint have a warning for this). And I would rather leverage that work from other people rather than attempting to maintain our own full featured tool.
> 
> 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. Any objection to landing the 2-10 patches without the check-code bit, and we can come back to pylint at a later date?


More information about the Mercurial-devel mailing list