Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\ (line continuation) not respected for pragmas #199

Closed
pylint-bot opened this issue Apr 22, 2014 · 3 comments · Fixed by #2923
Closed

\ (line continuation) not respected for pragmas #199

pylint-bot opened this issue Apr 22, 2014 · 3 comments · Fixed by #2923
Labels

Comments

@pylint-bot
Copy link

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.


@pylint-bot
Copy link
Author

Original comment by Sylvain Thénault (BitBucket: sthenault, GitHub: @sthenault?):


Removing version: 1.1 (automated comment)

@pylint-bot pylint-bot added Bug 🪲 Astroid Related to astroid labels Dec 9, 2015
@adamc55
Copy link

adamc55 commented Jan 21, 2016

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).

@The-Compiler
Copy link
Contributor

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).

wettenhj added a commit to mytardis/mydata that referenced this issue Apr 20, 2016
In this case, it's not trivial to put a # pylint: disable=invalid-name
at the end of the line, because it's a multiline statement, and this
bug exists in Pylint: pylint-dev/pylint#199
@rogalski rogalski removed the Astroid Related to astroid label Feb 9, 2017
msuozzo pushed a commit to msuozzo/pylint that referenced this issue Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants