---
source: crates/ruff_linter/src/rules/ruff/mod.rs
---
RUF008 Do not use mutable default values for dataclass attributes
  --> RUF008.py:10:34
   |
 8 | @dataclass
 9 | class A:
10 |     mutable_default: list[int] = []
   |                                  ^^
11 |     immutable_annotation: typing.Sequence[int] = []
12 |     without_annotation = []
   |

RUF008 Do not use mutable default values for dataclass attributes
  --> RUF008.py:20:34
   |
18 | @dataclass
19 | class B:
20 |     mutable_default: list[int] = []
   |                                  ^^
21 |     immutable_annotation: Sequence[int] = []
22 |     without_annotation = []
   |

RUF008 Do not use mutable default values for dataclass attributes
  --> RUF008.py:31:36
   |
29 | @dataclass
30 | class AWithQuotes:
31 |     mutable_default: 'list[int]' = []
   |                                    ^^
32 |     immutable_annotation: 'typing.Sequence[int]' = []
33 |     without_annotation = []
   |

RUF008 Do not use mutable default values for dataclass attributes
  --> RUF008.py:32:52
   |
30 | class AWithQuotes:
31 |     mutable_default: 'list[int]' = []
32 |     immutable_annotation: 'typing.Sequence[int]' = []
   |                                                    ^^
33 |     without_annotation = []
34 |     correct_code: 'list[int]' = KNOWINGLY_MUTABLE_DEFAULT
   |

RUF008 Do not use mutable default values for dataclass attributes
  --> RUF008.py:36:51
   |
34 |     correct_code: 'list[int]' = KNOWINGLY_MUTABLE_DEFAULT
35 |     perfectly_fine: 'list[int]' = field(default_factory=list)
36 |     class_variable: 'typing.ClassVar[list[int]]'= []
   |                                                   ^^
   |
