Hi Duncam
Duncan Gibson wrote:
>>> """ simple pylint example """
>>> def afunc(value_with_long_name):
>>> """ a doc string """
>>> value_with_long_name = 3
>>> i_want_to_mask_this_warning = value_with_long_name +
>>> value_with_long_name # pylint: disable=W0612
>>> iwant_to_see_this_warning = 7
>>> print value_with_long_name
>>>
>>>
>
> [...but this then throws up a C0301: line too long message...]
>
> surely Occam's Razor suggests that the simplest solution
> is just to have multiple disables at the end of the line:
>
> i_want_to_mask_this_warning = value_with_long_name +
> value_with_long_name # pylint: disable=W0612,C0301
>
I considered this already.
It works if I really create a long line. (not sure, whether my user
agent will break it or not.
i_want_to_mask_this_warning = value_with_long_name +
value_with_long_name # pylint: disable=W0612,C0301
What I wanted however is to have lines which are not too long.
They look ugly depending on the source code editor being used.
Not knowing who'll review my code I'd like to have code not
exceeding 80 characters per line in length
If I break the line with a backslash like:
i_want_to_mask_this_warning = value_with_long_name + \
value_with_long_name # pylint: disable=W0612,C0301
then the W0612 will NOT be ignored.
So the solutions I see are.
- the rather noisy #disable / #enable solution. reducing readbility
- leave a long line in the source code and disable two warnings
- rewrite the code in order to not have any warnings to mask
- rewrite the code such, that the line will be short enough even with
the pylint pragma
- accept, that more warnings will be ignored than realy intended (skip
the enable)
Is there anybody from Logilab listening who could
comment how difficult it would be to?
- ignore one line warnings for source code lines separated with a '\'
- introduce a new pragma, which will ignore the next statement
I love pylint (much better than pychecker), but still try to find ways
to NOT make my code less readble in order to satisfy pylint.
The danger in keeping (an visually ignoring) pylint warnings is, that one
might overlook a real warning in between all the false warning.
bye
Klaus
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects