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

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

RUF008 Do not use mutable default values for dataclass attributes
  --> RUF008_attrs.py:33:34
   |
31 | @attr.s
32 | class C:
33 |     mutable_default: list[int] = []
   |                                  ^^
34 |     immutable_annotation: Sequence[int] = []
35 |     without_annotation = []
   |

RUF008 Do not use mutable default values for dataclass attributes
  --> RUF008_attrs.py:42:34
   |
40 | @s
41 | class D:
42 |     mutable_default: list[int] = []
   |                                  ^^
43 |     immutable_annotation: Sequence[int] = []
44 |     without_annotation = []
   |

RUF008 Do not use mutable default values for dataclass attributes
  --> RUF008_attrs.py:53:54
   |
51 | @define
52 | class E:
53 |     mutable_default: list[int] = attrs.field(default=[])  # RUF008
   |                                                      ^^
54 |     mutable_default2: dict[str, int] = attrs.field(default={})  # RUF008
55 |     mutable_default3: set[int] = attrs.field(default=set())  # RUF008
   |

RUF008 Do not use mutable default values for dataclass attributes
  --> RUF008_attrs.py:54:60
   |
52 | class E:
53 |     mutable_default: list[int] = attrs.field(default=[])  # RUF008
54 |     mutable_default2: dict[str, int] = attrs.field(default={})  # RUF008
   |                                                            ^^
55 |     mutable_default3: set[int] = attrs.field(default=set())  # RUF008
56 |     mutable_default4: dict[str, int] = attrs.field(default=dict())  # RUF008
   |

RUF008 Do not use mutable default values for dataclass attributes
  --> RUF008_attrs.py:55:54
   |
53 |     mutable_default: list[int] = attrs.field(default=[])  # RUF008
54 |     mutable_default2: dict[str, int] = attrs.field(default={})  # RUF008
55 |     mutable_default3: set[int] = attrs.field(default=set())  # RUF008
   |                                                      ^^^^^
56 |     mutable_default4: dict[str, int] = attrs.field(default=dict())  # RUF008
57 |     correct_factory: list[int] = attrs.field(factory=list)  # okay
   |

RUF008 Do not use mutable default values for dataclass attributes
  --> RUF008_attrs.py:56:60
   |
54 |     mutable_default2: dict[str, int] = attrs.field(default={})  # RUF008
55 |     mutable_default3: set[int] = attrs.field(default=set())  # RUF008
56 |     mutable_default4: dict[str, int] = attrs.field(default=dict())  # RUF008
   |                                                            ^^^^^^
57 |     correct_factory: list[int] = attrs.field(factory=list)  # okay
58 |     immutable_default: tuple[int, ...] = attrs.field(default=())  # okay
   |

RUF008 Do not use mutable default values for dataclass attributes
  --> RUF008_attrs.py:67:50
   |
65 | @attr.s
66 | class F:
67 |     mutable_default: list[int] = attr.ib(default=[])  # RUF008
   |                                                  ^^
68 |     mutable_default2: dict[str, int] = attr.ib(default={})  # RUF008
69 |     correct_factory: list[int] = attr.ib(factory=list)  # okay
   |

RUF008 Do not use mutable default values for dataclass attributes
  --> RUF008_attrs.py:68:56
   |
66 | class F:
67 |     mutable_default: list[int] = attr.ib(default=[])  # RUF008
68 |     mutable_default2: dict[str, int] = attr.ib(default={})  # RUF008
   |                                                        ^^
69 |     correct_factory: list[int] = attr.ib(factory=list)  # okay
70 |     immutable_default: tuple[int, ...] = attr.ib(default=())  # okay
   |

RUF008 Do not use mutable default values for dataclass attributes
  --> RUF008_attrs.py:75:54
   |
73 | @attr.s
74 | class G:
75 |     mutable_default: list[int] = attr.attrib(default=[])  # RUF008
   |                                                      ^^
76 |     mutable_default2: set[int] = attr.attrib(default=set())  # RUF008
77 |     correct_factory: list[int] = attr.attrib(factory=list)  # okay
   |

RUF008 Do not use mutable default values for dataclass attributes
  --> RUF008_attrs.py:76:54
   |
74 | class G:
75 |     mutable_default: list[int] = attr.attrib(default=[])  # RUF008
76 |     mutable_default2: set[int] = attr.attrib(default=set())  # RUF008
   |                                                      ^^^^^
77 |     correct_factory: list[int] = attr.attrib(factory=list)  # okay
   |
