Pylint: \ (line continuation) not respected for pragmas

Created on 22 Apr 2014  路  3Comments  路  Source: PyCQA/pylint

Originally reported by: the mulhern (BitBucket: the_mulhern)


In the following code, the disable pragma is respected and no error is reported.

#!python


class Foo(object):
    """block-disable test"""

    def meth3(self):
        """test one line disabling"""
        print \
           self.bla # pylint: disable=E1101

But in this code the disable pragma is not respected and the error is reported.

#!python

class Foo(object):
    """block-disable test"""

    def meth3(self):
        """test one line disabling"""
        print self.bla \
           # pylint: disable=E1101

In the first case, the code is broken by the "\" but in the second the code is separated from the pragma by the slash. I believe that the pragma should be considered to be on the same line as the code in both cases, so neither should have an error.


bug

Most helpful comment

It would be nice to have this fixed. An alternative might be a pylint comment that applies only to the next line (so that you could put it right before the line in question).

All 3 comments

_Original comment by_ Sylvain Th茅nault (BitBucket: sthenault, GitHub: @sthenault?):


Removing version: 1.1 (automated comment)

It would be nice to have this fixed. An alternative might be a pylint comment that applies only to the next line (so that you could put it right before the line in question).

An alternative might be a pylint comment that applies only to the next line (so that you could put it right before the line in question).

I'd love that! I often want a # pylint: disable=some-code-here comment but keep it under the 79 char limit, so I usually end up ignoring it for the whole function (at least I think that's what currently happens when you put such a comment on a line on its own).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ethanchewy picture ethanchewy  路  3Comments

Hubro picture Hubro  路  3Comments

DevynCJohnson picture DevynCJohnson  路  3Comments

glmdgrielson picture glmdgrielson  路  3Comments

sambarluc picture sambarluc  路  3Comments