Basically I want dataclasses to default to frozen=True and slots=True with the option to opt out.
The rule would require passing the frozen and slots warts (if the python version is new enough to have slots)
Not sure about the naming of the rule
Or maybe the rule should be more general, like dataclass-require-params and the params are part of a config?
from dataclasses import dataclass
# error, missing frozen and slot params
@dataclass
class Data: ...
# ok, unless on a python version with slots
@dataclass(frozen=True)
class Data: ...
# ok
@dataclass(frozen=True, slots=True)
class Data: ...
# ok
@dataclass(frozen=False, slots=False)
class Data: ...
# ok
@dataclass(frozen=True, slots=False)
class Data: ...
Basically I want dataclasses to default to
frozen=True
andslots=True
with the option to opt out.The rule would require passing the
frozen
andslots
warts (if the python version is new enough to haveslots
)Not sure about the naming of the rule
Or maybe the rule should be more general, like
dataclass-require-params
and the params are part of a config?