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

invalid-name "propagates" to users on class properties #751

Closed
mikekap opened this issue Dec 18, 2015 · 6 comments
Closed

invalid-name "propagates" to users on class properties #751

mikekap opened this issue Dec 18, 2015 · 6 comments
Labels

Comments

@mikekap
Copy link

mikekap commented Dec 18, 2015

For example, given:

# a.py
# pylint: disable=invalid-name

class AClass(object):
    badName = 'hi'

# b.py
import a

def main():
    instance = a.AClass()
    instance.badName = 'yes'

main()

The output of pylint then varies depending on which files are being linted, and the order they're linted, e.g.

$ pylint a.py
# nothing
$ pylint b.py
# nothing
$ pylint a.py b.py
# nothing
$ pylint b.py a.py
************* Module b
C:  5, 4: Invalid attribute name "badName" (invalid-name)

That's really unexpected behavior. In this case, I would expect no errors since I disabled them in the declaring module.

This doesn't appear to happen when using instance properties (i.e. init + self.badName).

@mikekap mikekap changed the title invalid-name "propagates" to users on static properties invalid-name "propagates" to users on class properties Dec 18, 2015
@PCManticore
Copy link
Contributor

This seems a duplicate of #689.

@mikekap
Copy link
Author

mikekap commented Dec 24, 2015

It's definitely related, but I can also repro this with a single file:

def main():
    cl = Ac()
    cl.badName = 'hello'

class Ac(object):
    badName = 'hi'  # pylint: disable=invalid-name

main()

Results in

C:  3, 4: Invalid attribute name "badName" (invalid-name)

@kernc
Copy link

kernc commented Apr 14, 2016

There's a comment here that may shed some light: https://www.logilab.org/ticket/3733 ?

@PCManticore PCManticore added this to the 1.6.0 milestone May 9, 2016
@PCManticore
Copy link
Contributor

I can't replicate this with the latest release, but I can replicate another issue, that is affected by this. If the first file has a disable, then this disable would be propagated inadvertently for the other files, which don't contain this disable. This is probably because we use a global messages store for all the files, which leads to a wrong view of the disable / enable pairs. In order to fix it, we'll have to check the files as well.
And probably after that, we could replicate this issue.

@PCManticore
Copy link
Contributor

This would probably be fixed once we have #938 implemented (which depends partially on #618 as well). In this case, I'm moving it for that milestone.

@PCManticore PCManticore modified the milestones: 2.1, 2.0, 3.0, 2.2 Jun 16, 2016
@PCManticore PCManticore removed this from the 3.0 milestone Apr 25, 2018
@Pierre-Sassoulas
Copy link
Member

I'm going to close as this was fixed at some point, or I can't reproduce anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants