mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 20:10:09 +00:00
Tweak Yoda condition message (#1638)
This commit is contained in:
parent
34fec8cbd0
commit
8da2c4815a
2 changed files with 5 additions and 5 deletions
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue