Tweak Yoda condition message (#1638)

This commit is contained in:
Charlie Marsh 2023-01-04 15:58:01 -05:00 committed by GitHub
parent 34fec8cbd0
commit 8da2c4815a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -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 ...` | 🛠 | | SIM221 | AOrNotA | Use `True` instead of `... or not ...` | 🛠 |
| SIM222 | OrTrue | Use `True` instead of `... or True` | 🛠 | | SIM222 | OrTrue | Use `True` instead of `... or True` | 🛠 |
| SIM223 | AndFalse | Use `False` instead of `... and False` | 🛠 | | 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) ### flake8-tidy-imports (TID)

View file

@ -2932,7 +2932,7 @@ impl CheckKind {
CheckKind::OrTrue => "Use `True` instead of `... or True`".to_string(), CheckKind::OrTrue => "Use `True` instead of `... or True`".to_string(),
CheckKind::AndFalse => "Use `False` instead of `... and False`".to_string(), CheckKind::AndFalse => "Use `False` instead of `... and False`".to_string(),
CheckKind::YodaConditions(left, right) => { CheckKind::YodaConditions(left, right) => {
format!("Use `{left} == {right}` instead of `{right} == {left} (Yoda-conditions)`") format!("Yoda conditions are discouraged, use `{left} == {right}` instead")
} }
// pyupgrade // pyupgrade
CheckKind::TypeOfPrimitive(primitive) => { CheckKind::TypeOfPrimitive(primitive) => {
@ -3901,9 +3901,9 @@ impl CheckKind {
Some("Remove `object` inheritance".to_string()) Some("Remove `object` inheritance".to_string())
} }
CheckKind::UselessYieldFixture(..) => Some("Replace `yield` with `return`".to_string()), CheckKind::UselessYieldFixture(..) => Some("Replace `yield` with `return`".to_string()),
CheckKind::YodaConditions(left, right) => Some(format!( CheckKind::YodaConditions(left, right) => {
"Replace with `{left} == {right}` (Yoda-conditions)`" Some(format!("Replace Yoda condition with `{left} == {right}`"))
)), }
_ => None, _ => None,
} }
} }