-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
(#9670)
* 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>
- Loading branch information
1 parent
d60ba59
commit 4203d87
Showing
8 changed files
with
34 additions
and
21 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
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
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,28 @@ | ||
"""Check for duplicate function arguments.""" | ||
|
||
# pylint: disable=missing-docstring, line-too-long, unused-argument | ||
|
||
|
||
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] | ||
... | ||
|
||
def foo6(a, *a): # [duplicate-argument-name] | ||
... | ||
|
||
def foo7(a, /, a): # [duplicate-argument-name] | ||
... | ||
|
||
def foo8(a, **a): # [duplicate-argument-name] | ||
... |
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,9 @@ | ||
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:21:13:21:14:foo6:Duplicate argument name 'a' in function definition:HIGH | ||
duplicate-argument-name:24:15:24:16:foo7:Duplicate argument name 'a' in function definition:HIGH | ||
duplicate-argument-name:27:14:27:15:foo8:Duplicate argument name 'a' in function definition:HIGH |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.