[Python-projects] Is there a way to ask pylint to ignore a line?

Maarten ter Huurne maarten.ter.huurne at philips.com
Fri Jan 18 17:51:43 CET 2008


You wrote on 2008-01-18 05:32:40 PM:

> Is there a way to tell pylint to ignore a given line?
>
> For example, I'd like to do something like the following and have
> pylint not complain about any errors on the line marked #OK (or
> better yet be able to turn of specific errors/warnings for that line
> or perhaps at a function level.
>
> class foo:
>    def _protected(self):
>       pass
>
> def friend(f):
>     return f._protected # OK

Yes, you can disable a specific message for a line:

def friend(f):
    return f._protected # pylint: disable-msg=W0212

Or you can disable it for a block:

def friend(f):
    # pylint: disable-msg=W0212
    return f._protected

You can use the "include-ids" option to see the IDs of the messages, so you
know which one to suppress.

Bye,
            Maarten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.logilab.org/pipermail/python-projects/attachments/20080118/9ff5a5c7/attachment.htm 


More information about the Python-Projects mailing list