forked from pylint-dev/pylint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a false negative for
duplicate-argument-name
by including ``p…
…ositional-only``, ``*args`` and ``**kwargs`` arguments in the check. Closes pylint-dev#9669
- Loading branch information
Showing
6 changed files
with
29 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Fix a false negative for ``duplicate-argument-name`` by including ``positional-only``, ``*args`` and ``**kwargs`` arguments in the check. | ||
|
||
Closes #9669 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
"""Check for duplicate function arguments.""" | ||
|
||
# pylint: disable=missing-docstring, line-too-long | ||
|
||
|
||
def foo1(_, _): # [duplicate-argument-name] | ||
"""Function with duplicate argument name.""" | ||
... | ||
|
||
def foo2(_abc, *, _abc): # [duplicate-argument-name] | ||
"""Function with duplicate argument name.""" | ||
... | ||
|
||
def foo3(_, _=3): # [duplicate-argument-name] | ||
"""Function with duplicate argument name.""" | ||
... | ||
|
||
def foo4(_, *, _): # [duplicate-argument-name] | ||
"""Function with duplicate argument name.""" | ||
... | ||
|
||
def foo5(_, *_, _=3): # [duplicate-argument-name, duplicate-argument-name] | ||
... | ||
|
||
# +1: [duplicate-argument-name, duplicate-argument-name, duplicate-argument-name, duplicate-argument-name] | ||
def foo6(_, /, _, *_, _="_", **_): | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
duplicate-argument-name:4:12:4:13:foo1:Duplicate argument name _ in function definition:HIGH | ||
duplicate-argument-name:7:18:7:22:foo2:Duplicate argument name _abc in function definition:HIGH | ||
duplicate-argument-name:10:12:10:13:foo3:Duplicate argument name _ in function definition:HIGH | ||
duplicate-argument-name:13:15:13:16:foo4:Duplicate argument name _ in function definition:HIGH | ||
duplicate-argument-name:6:12:6:13:foo1:Duplicate argument name '_' in function definition:HIGH | ||
duplicate-argument-name:9:18:9:22:foo2:Duplicate argument name '_abc' in function definition:HIGH | ||
duplicate-argument-name:12:12:12:13:foo3:Duplicate argument name '_' in function definition:HIGH | ||
duplicate-argument-name:15:15:15:16:foo4:Duplicate argument name '_' in function definition:HIGH | ||
duplicate-argument-name:18:13:18:14:foo5:Duplicate argument name '_' in function definition:HIGH | ||
duplicate-argument-name:18:16:18:17:foo5:Duplicate argument name '_' in function definition:HIGH | ||
duplicate-argument-name:22:15:22:16:foo6:Duplicate argument name '_' in function definition:HIGH | ||
duplicate-argument-name:22:19:22:20:foo6:Duplicate argument name '_' in function definition:HIGH | ||
duplicate-argument-name:22:22:22:23:foo6:Duplicate argument name '_' in function definition:HIGH | ||
duplicate-argument-name:22:31:22:32:foo6:Duplicate argument name '_' in function definition:HIGH |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.