mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
[ruff
] add fix safety section (RUF033
) (#17760)
This PR adds the fix safety section for rule `RUF033` (https://github.com/astral-sh/ruff/issues/15584 ).
This commit is contained in:
parent
8845a13efb
commit
5792ed15da
1 changed files with 6 additions and 0 deletions
|
@ -61,6 +61,12 @@ use super::helpers::{dataclass_kind, DataclassKind};
|
||||||
/// foo = Foo() # Prints '1 2'.
|
/// foo = Foo() # Prints '1 2'.
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
/// ## Fix safety
|
||||||
|
///
|
||||||
|
/// This fix is always marked as unsafe because, although switching to `InitVar` is usually correct,
|
||||||
|
/// it is incorrect when the parameter is not intended to be part of the public API or when the value
|
||||||
|
/// is meant to be shared across all instances.
|
||||||
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: Post-init processing](https://docs.python.org/3/library/dataclasses.html#post-init-processing)
|
/// - [Python documentation: Post-init processing](https://docs.python.org/3/library/dataclasses.html#post-init-processing)
|
||||||
/// - [Python documentation: Init-only variables](https://docs.python.org/3/library/dataclasses.html#init-only-variables)
|
/// - [Python documentation: Init-only variables](https://docs.python.org/3/library/dataclasses.html#init-only-variables)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue