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

False negatives for duplicate-argument-name #9669

Closed
mbyrnepr2 opened this issue May 22, 2024 · 0 comments · Fixed by #9670
Closed

False negatives for duplicate-argument-name #9669

mbyrnepr2 opened this issue May 22, 2024 · 0 comments · Fixed by #9670
Assignees
Labels
False Negative 🦋 No message is emitted but something is wrong with the code
Milestone

Comments

@mbyrnepr2
Copy link
Member

mbyrnepr2 commented May 22, 2024

Bug description

Currently only positional-or-keyword and keyword-only arguments are taken into account for this check:

def foo1(_, _): # [duplicate-argument-name]
...

def foo3(_, _=3): # [duplicate-argument-name]
...

def foo4(_, *, _): # [duplicate-argument-name]
...

positional-only, *varargs and **kwargs are not considered currently:

def foo5(_, *_):
    """*vararg"""

def foo6(_, /, _):
    """positional-only"""

def foo7(_, **_):
    """**kwargs"""

Configuration

No response

Command used

pylint a.py

Pylint output

The message is not emitted because of the false negatives.

Expected behavior

E0108: Duplicate argument name

Pylint version

pylint 3.3.0-dev0
astroid 3.3.0-dev0
Python 3.12.0

OS / Environment

No response

Additional dependencies

No response

@mbyrnepr2 mbyrnepr2 added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label May 22, 2024
@mbyrnepr2 mbyrnepr2 self-assigned this May 22, 2024
mbyrnepr2 added a commit to mbyrnepr2/pylint that referenced this issue May 22, 2024
…ositional-only``, ``*args`` and ``**kwargs`` arguments in the check.

Closes pylint-dev#9669
@mbyrnepr2 mbyrnepr2 added the False Negative 🦋 No message is emitted but something is wrong with the code label May 22, 2024
@Pierre-Sassoulas Pierre-Sassoulas added this to the 3.3.0 milestone May 22, 2024
@Pierre-Sassoulas Pierre-Sassoulas removed the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label May 22, 2024
DanielNoord pushed a commit that referenced this issue Jun 3, 2024
* Fix a false negative for ``duplicate-argument-name`` by including ``positional-only``, ``*args`` and ``**kwargs`` arguments in the check.

Closes #9669

Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
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

Successfully merging a pull request may close this issue.

2 participants