pylint icon indicating copy to clipboard operation
pylint copied to clipboard

W0235 useless-super-delegation false positive for keyword arguments with different default values

Open AIGeneratedUsername opened this issue 1 year ago • 1 comments

Bug description

This issue is just one more Pylint regression (we introduced again the same bug).

Previously reported:

  • https://github.com/PyCQA/pylint/issues/3934
  • https://github.com/PyCQA/pylint/issues/3773
  • https://github.com/PyCQA/pylint/issues/2270
  • https://github.com/PyCQA/pylint/issues/1085
  • https://github.com/PyCQA/pylint/issues/1085

It will be great to have a test for this check.

class Foo:
    def __init__(*, bar = 10):
         ...

class Child(Foo):
    def __init__(*, bar = 99999):
         super().__init__(bar=bar)

Configuration

No response

Command used

pre-commit run pylint --all-files

Pylint output

W0235: Useless super delegation in method '__init__' (useless-super-delegation)

Expected behavior

No warnings

Pylint version

pylint 2.14.5
astroid 2.11.7
Python 3.10.6 (main, Aug  2 2022, 15:11:28) [GCC 9.4.0]

OS / Environment

No response

Additional dependencies

No response

AIGeneratedUsername avatar Aug 10 '22 18:08 AIGeneratedUsername

Thank you for opening the issue. Do you want to contribute a fix ?

Pierre-Sassoulas avatar Aug 10 '22 18:08 Pierre-Sassoulas

Hey all. It looks like the example provided is not a false positive since adding it to the functional tests yields a successful run. Perhaps the Pylint version which the pre-commit uses is a little out of date?

mbyrnepr2 avatar Aug 20 '22 20:08 mbyrnepr2

Right, I can't reproduce either.

jacobtylerwalls avatar Aug 21 '22 00:08 jacobtylerwalls