-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Closed
Copy link
Labels
ruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
-
List of keywords you searched for before creating this issue. Write them down here so that others can find this issue more easily and help provide feedback.
- "PRL0913"
- "too-many-arguments"
- "self"
- "cls"
- "false positve"
-
A minimal code snippet that reproduces the bug.
class DemoClass: def __init__(self, one, two, three, four, five): pass @classmethod def bar(cls, one, two, three, four, five): pass @staticmethod def foo(one, two, three, four, five): pass
-
The command you invoked (e.g.,
ruff /path/to/file.py --fix
), ideally including the--isolated
flag.ruff check foo.py --isolated --select PLR0913
This produles the following output:
(.venv) ~\PycharmProjects\test git:[dev] ruff check foo.py --isolated --select PLR0913 foo.py:2:9: PLR0913 Too many arguments in function definition (6 > 5) | 1 | class DemoClass: 2 | def __init__(self, one, two, three, four, five): | ^^^^^^^^ PLR0913 3 | pass | foo.py:6:9: PLR0913 Too many arguments in function definition (6 > 5) | 5 | @classmethod 6 | def bar(cls, one, two, three, four, five): | ^^^ PLR0913 7 | pass | Found 2 errors.
Apparently, ruff considers
self
andcls
when computing the number of arguments. However, these arguments are mandatory anyway, are not visible to the consumer of these methods and don't introduce any maintenance overhead. I propose that ruff ignores them. -
The current Ruff settings (any relevant sections from yourusedpyproject.toml
).--isolated
flag above -
The current Ruff version (
ruff --version
):ruff 0.5.1
Metadata
Metadata
Assignees
Labels
ruleImplementing or modifying a lint ruleImplementing or modifying a lint rule