mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:38:25 +00:00
[ruff
] add fix safety section (RUF005
) (#17484)
The PR add the `fix safety` section for rule `RUF005` (#15584 ). --------- Co-authored-by: Dylan <dylwil3@gmail.com>
This commit is contained in:
parent
64ba39a385
commit
b578a828ef
1 changed files with 6 additions and 0 deletions
|
@ -33,6 +33,12 @@ use crate::fix::snippet::SourceCodeSnippet;
|
|||
/// bar = [1, *foo, 5, 6]
|
||||
/// ```
|
||||
///
|
||||
/// ## Fix safety
|
||||
///
|
||||
/// The fix is always marked as unsafe because the `+` operator uses the `__add__` magic method and
|
||||
/// `*`-unpacking uses the `__iter__` magic method. Both of these could have custom
|
||||
/// implementations, causing the fix to change program behaviour.
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 448 – Additional Unpacking Generalizations](https://peps.python.org/pep-0448/)
|
||||
/// - [Python documentation: Sequence Types — `list`, `tuple`, `range`](https://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue