λ cat xyz.py
from dataclasses import dataclass
@dataclass
class X:
class_var = {}
x: int
print(X(123).x)
λ ruff check xyz.py --select RUF008
xyz.py:5:17: RUF008 Do not use mutable default values for dataclass attributes
Found 1 error.
This is a false positive, class_var is not a dataclass attribute. Python 3.11 (which tries to error at runtime for mutable dataclass attributes) also accepts it