From 65a38baae785d49fafa3fc5ca1fdd87cd59733ee Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 4 Jan 2023 15:57:51 -0500 Subject: [PATCH] Tweak Yoda condition message --- README.md | 2 +- src/registry.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4957b6eec3646..2e916c2f340e6 100644 --- a/README.md +++ b/README.md @@ -968,7 +968,7 @@ For more, see [flake8-simplify](https://pypi.org/project/flake8-simplify/0.19.3/ | SIM221 | AOrNotA | Use `True` instead of `... or not ...` | 🛠 | | SIM222 | OrTrue | Use `True` instead of `... or True` | 🛠 | | SIM223 | AndFalse | Use `False` instead of `... and False` | 🛠 | -| SIM300 | YodaConditions | Use `left == right` instead of `right == left (Yoda-conditions)` | 🛠 | +| SIM300 | YodaConditions | Yoda conditions are discouraged, use `left == right` instead | 🛠 | ### flake8-tidy-imports (TID) diff --git a/src/registry.rs b/src/registry.rs index 5bf43c91246d6..e2b54121fd66f 100644 --- a/src/registry.rs +++ b/src/registry.rs @@ -2932,7 +2932,7 @@ impl CheckKind { CheckKind::OrTrue => "Use `True` instead of `... or True`".to_string(), CheckKind::AndFalse => "Use `False` instead of `... and False`".to_string(), CheckKind::YodaConditions(left, right) => { - format!("Use `{left} == {right}` instead of `{right} == {left} (Yoda-conditions)`") + format!("Yoda conditions are discouraged, use `{left} == {right}` instead") } // pyupgrade CheckKind::TypeOfPrimitive(primitive) => { @@ -3901,9 +3901,9 @@ impl CheckKind { Some("Remove `object` inheritance".to_string()) } CheckKind::UselessYieldFixture(..) => Some("Replace `yield` with `return`".to_string()), - CheckKind::YodaConditions(left, right) => Some(format!( - "Replace with `{left} == {right}` (Yoda-conditions)`" - )), + CheckKind::YodaConditions(left, right) => { + Some(format!("Replace Yoda condition with `{left} == {right}`")) + } _ => None, } }