#28777·ruff

`too-many-positional-arguments`: dataclasses?

Author: decorator-factoryCreated Sep 22, 2026Updated Sep 28, 2026
Labelsruleneeds-decision

Summary

too-many-positional-arguments (PLR0917)

python
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)