From cf18bededfcdb4b629ba6023fc752d350a32dbd2 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 14 Aug 2024 09:59:28 +0100 Subject: [PATCH] Revert "[Ruff 0.6] Stabilise `PLR6104` (#12858)" This reverts commit cea8d57dc84590a6b2587e17d22503de705e2fda. --- crates/ruff_linter/src/codes.rs | 2 +- .../rules/pylint/rules/non_augmented_assignment.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/ruff_linter/src/codes.rs b/crates/ruff_linter/src/codes.rs index 1aab77ef91b4d..9aad7a11f260b 100644 --- a/crates/ruff_linter/src/codes.rs +++ b/crates/ruff_linter/src/codes.rs @@ -262,7 +262,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> { (Pylint, "R2004") => (RuleGroup::Stable, rules::pylint::rules::MagicValueComparison), (Pylint, "R2044") => (RuleGroup::Stable, rules::pylint::rules::EmptyComment), (Pylint, "R5501") => (RuleGroup::Stable, rules::pylint::rules::CollapsibleElseIf), - (Pylint, "R6104") => (RuleGroup::Stable, rules::pylint::rules::NonAugmentedAssignment), + (Pylint, "R6104") => (RuleGroup::Preview, rules::pylint::rules::NonAugmentedAssignment), (Pylint, "R6201") => (RuleGroup::Preview, rules::pylint::rules::LiteralMembership), (Pylint, "R6301") => (RuleGroup::Preview, rules::pylint::rules::NoSelfUse), (Pylint, "W0108") => (RuleGroup::Preview, rules::pylint::rules::UnnecessaryLambda), diff --git a/crates/ruff_linter/src/rules/pylint/rules/non_augmented_assignment.rs b/crates/ruff_linter/src/rules/pylint/rules/non_augmented_assignment.rs index a0b2ccf3bb0b7..fa73252872ef7 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/non_augmented_assignment.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/non_augmented_assignment.rs @@ -14,12 +14,12 @@ use crate::checkers::ast::Checker; /// statements. /// /// ## Why is this bad? -/// If the right-hand side of an assignment statement consists of a binary -/// operation in which one operand is the same as the assignment target, -/// it can be rewritten as an augmented assignment. For example, `x = x + 1 -/// can be rewritten as `x += 1`. +/// If an assignment statement consists of a binary operation in which one +/// operand is the same as the assignment target, it can be rewritten as an +/// augmented assignment. For example, `x = x + 1` can be rewritten as +/// `x += 1`. /// -/// When performing such an operation, an augmented assignment is more concise +/// When performing such an operation, augmented assignments are more concise /// and idiomatic. /// /// ## Known problems @@ -31,7 +31,7 @@ use crate::checkers::ast::Checker; /// For example, `x = "prefix-" + x` is not equivalent to `x += "prefix-"`, /// while `x = 1 + x` is equivalent to `x += 1`. /// -/// If the type of the left-hand side cannot be trivially inferred, the rule +/// If the type of the left-hand side cannot be inferred trivially, the rule /// will ignore the assignment. /// /// ## Example