pylint-dev / pylint

It's not just a linter that annoys you!
https://pylint.readthedocs.io/en/latest/
GNU General Public License v2.0
5.19k stars 1.1k forks source link

False positive for E1120 (no-value-for-parameter) #3632

Open bje- opened 4 years ago

bje- commented 4 years ago

Steps to reproduce

  1. Run pylint over the following small test case:
"""docstring"""

class PV1Axis():
    """Single-axis tracking PV."""
    def __init__(self, polygon, capacity, filename, column, build_limit=None, label='PV'):
        pass

class Biofuel():
    """Model of open cycle gas turbines burning biofuel."""
    def __init__(self, polygon, capacity, label='biofuel'):
        pass

for g in [PV1Axis, Biofuel]: # nb: works if I reverse the list order
    if g == Biofuel:
        g(0, 100)

Current behavior

example.py:15: [E1120(no-value-for-parameter), ] No value for argument 'filename' in constructor call
example.py:15: [E1120(no-value-for-parameter), ] No value for argument 'column' in constructor call

Expected behavior

No warnings should be generated.

pylint --version output

pylint 2.5.2
astroid 2.4.1
Python 3.6.9 (default, Apr 18 2020, 01:56:04) 
[GCC 8.4.0]
bje- commented 4 years ago

Updated with a small, standalone test case.

bje- commented 3 years ago

Still present in Pylint 2.8.3.

bje- commented 1 year ago

This was fixed somewhere along the way. Works in Pylint 2.14.5.

Pierre-Sassoulas commented 1 year ago

Thank you for checking @bje- , I must have made a mistake when labeling on july 2, or we regressed since 2.14.5. I'm reopening so I check what the problem was before releasing 2.15.0.

Pierre-Sassoulas commented 1 year ago

Also still an issue on current main.