Summary
too-many-positional-arguments (PLR0917)
from dataclasses import dataclass
@dataclass
class Thing:
foo: float
bar: float
baz: float
width: float
height: float
is_fizz: bool
is_buzz: bool
is_fizzbuzz: bool
This implicilty creates an __init__ with 8 positional arguments, so a caller is allowed to do Thing(1, 2, 3, 4, 5, True, True, True) which doesn't look very clear. However, too-many-positional-arguments does not catch this.
I'm not sure how to best detect this, since there's more than just built-in dataclasses. (hardcode dataclasses, msgspec, pydantic?) (if we had type information, we could check if a "dataclass transform" is used)
Summary
too-many-positional-arguments(PLR0917)This implicilty creates an
__init__with 8 positional arguments, so a caller is allowed to doThing(1, 2, 3, 4, 5, True, True, True)which doesn't look very clear. However,too-many-positional-argumentsdoes not catch this.I'm not sure how to best detect this, since there's more than just built-in
dataclasses. (hardcodedataclasses,msgspec,pydantic?) (if we had type information, we could check if a "dataclass transform" is used)