Skip to content

Commit

Permalink
Tweak Yoda condition message (#1638)
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jan 4, 2023
1 parent 34fec8c commit 8da2c48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions src/registry.rs
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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,
}
}
Expand Down

0 comments on commit 8da2c48

Please sign in to comment.