Alex Margarit | 1 Apr 2010 18:23
Picon

Re: A fix for Pylint #8776, inline message supression

Hi,

Thank you for your feedback, Sylvain. I agree that the root of the
problem lies in the block range.

I attached a new patch that removes the string comparison with a
cleaner instanceof check. Tests are included too.

Thank you,
Alex Margarit
Team Tahiti, U of T

On Mon, Mar 22, 2010 at 3:19 AM, Sylvain Thénault
<sylvain.thenault <at> logilab.fr> wrote:
> On 21 mars 11:33, Alex Margarit wrote:
>> Hey,
>
> Hi,
>
> sorry, I've been missing some time last week to review pylint patches.
> Hopefuly this week will be better :)
>
>> I was wondering if anyone had the time to take a look at the patch I
>> sent for Pylint ticket #8776. Do you think my solution is appropriate?
>>
>> http://www.logilab.org/ticket/8776
>>
>> I reattached the diff. Thanks,
>> diff -r f5f084e5267a ChangeLog
>> diff -r f5f084e5267a lint.py
>> --- a/lint.py Thu Mar 04 12:12:32 2010 +0100
>> +++ b/lint.py Tue Mar 16 01:35:36 2010 -0400
>>  <at>  <at>  -466,7 +466,10  <at>  <at> 
>>                                  self._module_msgs_state[msgid][line] = state
>>                              except KeyError:
>>                                  self._module_msgs_state[msgid] = {line: state}
>> -                    del lines[lineno]
>> +                    # the arguments list is a special case, since it is part of
>> +                    # the same logical code line as the function definition
>> +                    if str(node) != 'arguments()':
>> +                        del lines[lineno]
>
> I don't think this solution is appropriate. First, testing str(node) is definitly
> a bad idea. Using isinstance(node, ...) would be e bit better but still sound bad.
>
> Actually, the special casing on arguments at this point of the code seems to be
> the flaw. IMO the root of the pb lies in values returned by block_range() for function
> and / or arguments nodes.
>
> --
> Sylvain Thénault                               LOGILAB, Paris (France)
> Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
> Développement logiciel sur mesure:       http://www.logilab.fr/services
> CubicWeb, the semantic web framework:    http://www.cubicweb.org
>
>
Attachment (alex8776-2.diff): text/x-patch, 2640 bytes
_______________________________________________
Python-Projects mailing list
Python-Projects <at> lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects

Gmane