pylint-dev/pylint

arguments-differ: number of parameters was some number ... and is now the same number in overridden ...

Open

#5.793 geöffnet am 11. Feb. 2022

Auf GitHub ansehen
 (5 Kommentare) (9 Reaktionen) (0 zugewiesene Personen)Python (1.059 Forks)batch import
C: arguments-differDocumentation :green_book:Good first issue

Repository-Metriken

Stars
 (4.978 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 58T 21h) (63 gemergte PRs in 30 T)

Beschreibung

Bug description

The following code produces a warning that does not really tell much about what is going wrong:

"""Comment."""
class Base:
    """Comment."""
    def fun(self, var: int) -> int:
        """Comment."""
        print(var)

class Class(Base):
    """Comment."""
    def fun(self, *, var: int) -> int:
        print(var)

Configuration

No response

Command used

pylint bug.py

Pylint output

************* Module bug
bug.py:15:4: W0221: Number of parameters was 2 in 'Base.fun' and is now 2 in overridden 'Class.fun' method (arguments-differ)

------------------------------------------------------------------
Your code has been rated at 8.33/10 (previous run: 8.33/10, +0.00)

Expected behavior

I'd expect a more meaningful warning not only referring to the number parameters (which has not changed from Base.fun to Class.fun).

Pylint version

pylint 2.12.2
astroid 2.9.3
Python 3.10.2 (main, Jan 17 2022, 14:26:36) [GCC 7.5.0]

OS / Environment

No response

Additional dependencies

No response

Contributor Guide