Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak Yoda condition message #1638

Merged
merged 1 commit into from Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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