BSK-E0142
error
dataclass_transform violations when the transform is applied via a base class
When a class is decorated with @dataclass_transform(...), subclasses that inherit from it behave like dataclasses with the transform's default settings overridable by keyword arguments on the class definition.
This rule detects: 1. A non-frozen subclass inheriting from a frozen transform-class (line 51). 2. Attribute assignment on a frozen transform-class instance (lines 63, 122). 3. Positional arguments to a kw_only transform-class constructor (lines 66, 82). 4. Comparison operators on transform-class instances that lack order=True (line 72).
from typing import dataclass_transform
@dataclass_transform(kw_only_default=True)
class ModelBase: ...
class Customer(ModelBase, frozen=True):
id: int
c = Customer(3) # E — kw_only requires keyword args
c.id = 4 # E — frozen instance is immutable
How to handle it
Every rule is on by default — strict is the default, not a cage. You can dial
BSK-E0142 down per-file or per-path from your editor or
pyproject.toml, or fix the code
so it type-checks. See the Type System rules and
the complete diagnostic reference.
Canonical URL: https://www.basilisk-python.dev/errors/BSK-E0142