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

Missing E1120 for the incorrectly called class methods of objects passed to the functions #5116

Closed
manefix opened this issue Oct 4, 2021 · 1 comment
Labels
False Negative 🦋 No message is emitted but something is wrong with the code

Comments

@manefix
Copy link

manefix commented Oct 4, 2021

Bug description

  1. create class with some method with any mandatory field, e.g. 'error_message'
  2. create some function with one argument accepted with type of that class created above
  3. inside that function just call the class method of the passed object with no arguments
  4. Run pylint vs the code above

Expected Result

E1120: No value for argument 'error_message' in method call (no-value-for-parameter)

Actual Result

Nothing is reported, and this is pretty common situation

Sample that is required to work but it is not:

class Report:
    def add_error(self, error_message: str):
        print(self, error_message)


def main(report: Report):
    report.add_error() # here we should pass printable value, but
    #  forgot about it, pycharm will remind us, but not pylint... 

Currently working:

class Report:
    def add_error(self, error_message: str):
        print(self, error_message)

report = Report()
report.add_error() # outside the function this code will cause pylint violations

Command used

pylint test.py

Pylint output

empty

Expected behavior

E1120: No value for argument 'error_message' in method call (no-value-for-parameter)

Pylint version

pylint 2.11.1

OS / Environment

MacOS BigSur 11.6

@manefix manefix added Bug 🪲 Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Oct 4, 2021
@DanielNoord DanielNoord added False Negative 🦋 No message is emitted but something is wrong with the code and removed Bug 🪲 Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Feb 9, 2022
@Pierre-Sassoulas
Copy link
Member

Closing as duplicate of #4813

@Pierre-Sassoulas Pierre-Sassoulas closed this as not planned Won't fix, can't repro, duplicate, stale Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Negative 🦋 No message is emitted but something is wrong with the code
Projects
None yet
Development

No branches or pull requests

3 participants