From 073a71ca9aedc507f39b399d0f9e65bc35765038 Mon Sep 17 00:00:00 2001 From: Yunchi Pang Date: Fri, 20 Jun 2025 08:40:44 -0700 Subject: [PATCH] [`pylint`] add fix safety section (`PLR1714`) (#18415) parent #15584 fix was introduced in #7910 --------- Co-authored-by: dylwil3 --- .../src/rules/pylint/rules/repeated_equality_comparison.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/ruff_linter/src/rules/pylint/rules/repeated_equality_comparison.rs b/crates/ruff_linter/src/rules/pylint/rules/repeated_equality_comparison.rs index 5b4bda45a9..4ac8f3f79f 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/repeated_equality_comparison.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/repeated_equality_comparison.rs @@ -32,6 +32,12 @@ use crate::{AlwaysFixableViolation, Edit, Fix}; /// If the items are hashable, use a `set` for efficiency; otherwise, use a /// `tuple`. /// +/// ## Fix safety +/// This rule is always unsafe since literal sets and tuples +/// evaluate their members eagerly whereas `or` comparisons +/// are short-circuited. It is therefore possible that a fix +/// will change behavior in the presence of side-effects. +/// /// ## Example /// ```python /// foo == "bar" or foo == "baz" or foo == "qux"