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

E0202: (method-hidden) false positive when mixed member/method #3936

Closed
socketpair opened this issue Nov 6, 2020 · 4 comments · Fixed by #4177
Closed

E0202: (method-hidden) false positive when mixed member/method #3936

socketpair opened this issue Nov 6, 2020 · 4 comments · Fixed by #4177
Labels
Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code Good first issue Friendly and approachable by new contributors Help wanted 🙏 Outside help would be appreciated, good for new contributors

Comments

@socketpair
Copy link

socketpair commented Nov 6, 2020

Generates false positive:

class Parent:
    def __init__(self):
        self.__check_should_start = None

class Child(Parent):
    def __check_should_start(self):
        pass

works OK:

class Parent:
    def __check_should_start(self):
        pass

class Child(Parent):
    def __check_should_start(self):
        pass
$ pylint-3 --version
pylint 2.4.4
astroid 2.3.3
Python 3.8.6 (default, Sep 25 2020, 00:00:00) 
[GCC 10.2.1 20200723 (Red Hat 10.2.1-1)]
@hippo91
Copy link
Contributor

hippo91 commented Nov 19, 2020

@socketpair thanks for the report.
However it don't seem to be a false positive:

pylint --help-msg method-hidden
:method-hidden (E0202): *An attribute defined in %s line %s hides this method*
  Used when a class defines a method which is hidden by an instance attribute
  from an ancestor class or set by some client code. This message belongs to
  the classes checker.

It seems that the help message correspond exactly to the situation.
I close this issue but do not hesitate to answer if you think i am wrong. I wiil reopen the issue if it is the case.

@hippo91 hippo91 closed this as completed Nov 19, 2020
@socketpair
Copy link
Author

NO! It does not hide ! Since they are PRIVATE variables. And of course they are different. If it were ._example (i.e. protected var) it would be OK to raise the warning.

@hippo91
Copy link
Contributor

hippo91 commented Nov 19, 2020

@socketpair thanks. I seems a bug then.

@hippo91 hippo91 reopened this Nov 19, 2020
@hippo91 hippo91 added Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code Good first issue Friendly and approachable by new contributors labels Nov 19, 2020
@hippo91
Copy link
Contributor

hippo91 commented Nov 19, 2020

For anyone wanting to contribute, please have a look to the classes.py module in the method visit_functiondef.

@Pierre-Sassoulas Pierre-Sassoulas added the Help wanted 🙏 Outside help would be appreciated, good for new contributors label Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code Good first issue Friendly and approachable by new contributors Help wanted 🙏 Outside help would be appreciated, good for new contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants