---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM300 [*] Yoda condition detected
 --> SIM300.py:2:1
  |
1 | # Errors
2 | "yoda" == compare  # SIM300
  | ^^^^^^^^^^^^^^^^^
3 | 42 == age  # SIM300
4 | ("a", "b") == compare  # SIM300
  |
help: Rewrite as `compare == "yoda"`
  |
1 | # Errors
  - "yoda" == compare  # SIM300
2 + compare == "yoda"  # SIM300
3 | 42 == age  # SIM300
  |

SIM300 [*] Yoda condition detected
 --> SIM300.py:3:1
  |
1 | # Errors
2 | "yoda" == compare  # SIM300
3 | 42 == age  # SIM300
  | ^^^^^^^^^
4 | ("a", "b") == compare  # SIM300
5 | "yoda" <= compare  # SIM300
  |
help: Rewrite as `age == 42`
  |
2 | "yoda" == compare  # SIM300
  - 42 == age  # SIM300
3 + age == 42  # SIM300
4 | ("a", "b") == compare  # SIM300
  |

SIM300 [*] Yoda condition detected
 --> SIM300.py:4:1
  |
2 | "yoda" == compare  # SIM300
3 | 42 == age  # SIM300
4 | ("a", "b") == compare  # SIM300
  | ^^^^^^^^^^^^^^^^^^^^^
5 | "yoda" <= compare  # SIM300
6 | "yoda" < compare  # SIM300
  |
help: Rewrite as `compare == ("a", "b")`
  |
3 | 42 == age  # SIM300
  - ("a", "b") == compare  # SIM300
4 + compare == ("a", "b")  # SIM300
5 | "yoda" <= compare  # SIM300
  |

SIM300 [*] Yoda condition detected
 --> SIM300.py:5:1
  |
3 | 42 == age  # SIM300
4 | ("a", "b") == compare  # SIM300
5 | "yoda" <= compare  # SIM300
  | ^^^^^^^^^^^^^^^^^
6 | "yoda" < compare  # SIM300
7 | 42 > age  # SIM300
  |
help: Rewrite as `compare >= "yoda"`
  |
4 | ("a", "b") == compare  # SIM300
  - "yoda" <= compare  # SIM300
5 + compare >= "yoda"  # SIM300
6 | "yoda" < compare  # SIM300
  |

SIM300 [*] Yoda condition detected
 --> SIM300.py:6:1
  |
4 | ("a", "b") == compare  # SIM300
5 | "yoda" <= compare  # SIM300
6 | "yoda" < compare  # SIM300
  | ^^^^^^^^^^^^^^^^
7 | 42 > age  # SIM300
8 | -42 > age  # SIM300
  |
help: Rewrite as `compare > "yoda"`
  |
5 | "yoda" <= compare  # SIM300
  - "yoda" < compare  # SIM300
6 + compare > "yoda"  # SIM300
7 | 42 > age  # SIM300
  |

SIM300 [*] Yoda condition detected
 --> SIM300.py:7:1
  |
5 | "yoda" <= compare  # SIM300
6 | "yoda" < compare  # SIM300
7 | 42 > age  # SIM300
  | ^^^^^^^^
8 | -42 > age  # SIM300
9 | +42 > age  # SIM300
  |
help: Rewrite as `age < 42`
  |
6 | "yoda" < compare  # SIM300
  - 42 > age  # SIM300
7 + age < 42  # SIM300
8 | -42 > age  # SIM300
  |

SIM300 [*] Yoda condition detected
  --> SIM300.py:8:1
   |
 6 | "yoda" < compare  # SIM300
 7 | 42 > age  # SIM300
 8 | -42 > age  # SIM300
   | ^^^^^^^^^
 9 | +42 > age  # SIM300
10 | YODA == age  # SIM300
   |
help: Rewrite as `age < -42`
  |
7 | 42 > age  # SIM300
  - -42 > age  # SIM300
8 + age < -42  # SIM300
9 | +42 > age  # SIM300
  |

SIM300 [*] Yoda condition detected
  --> SIM300.py:9:1
   |
 7 | 42 > age  # SIM300
 8 | -42 > age  # SIM300
 9 | +42 > age  # SIM300
   | ^^^^^^^^^
10 | YODA == age  # SIM300
11 | YODA > age  # SIM300
   |
help: Rewrite as `age < +42`
   |
8  | -42 > age  # SIM300
   - +42 > age  # SIM300
9  + age < +42  # SIM300
10 | YODA == age  # SIM300
   |

SIM300 [*] Yoda condition detected
  --> SIM300.py:10:1
   |
 8 | -42 > age  # SIM300
 9 | +42 > age  # SIM300
10 | YODA == age  # SIM300
   | ^^^^^^^^^^^
11 | YODA > age  # SIM300
12 | YODA >= age  # SIM300
   |
help: Rewrite as `age == YODA`
   |
9  | +42 > age  # SIM300
   - YODA == age  # SIM300
10 + age == YODA  # SIM300
11 | YODA > age  # SIM300
   |

SIM300 [*] Yoda condition detected
  --> SIM300.py:11:1
   |
 9 | +42 > age  # SIM300
10 | YODA == age  # SIM300
11 | YODA > age  # SIM300
   | ^^^^^^^^^^
12 | YODA >= age  # SIM300
13 | JediOrder.YODA == age  # SIM300
   |
help: Rewrite as `age < YODA`
   |
10 | YODA == age  # SIM300
   - YODA > age  # SIM300
11 + age < YODA  # SIM300
12 | YODA >= age  # SIM300
   |

SIM300 [*] Yoda condition detected
  --> SIM300.py:12:1
   |
10 | YODA == age  # SIM300
11 | YODA > age  # SIM300
12 | YODA >= age  # SIM300
   | ^^^^^^^^^^^
13 | JediOrder.YODA == age  # SIM300
14 | 0 < (number - 100)  # SIM300
   |
help: Rewrite as `age <= YODA`
   |
11 | YODA > age  # SIM300
   - YODA >= age  # SIM300
12 + age <= YODA  # SIM300
13 | JediOrder.YODA == age  # SIM300
   |

SIM300 [*] Yoda condition detected
  --> SIM300.py:13:1
   |
11 | YODA > age  # SIM300
12 | YODA >= age  # SIM300
13 | JediOrder.YODA == age  # SIM300
   | ^^^^^^^^^^^^^^^^^^^^^
14 | 0 < (number - 100)  # SIM300
15 | B<A[0][0]or B
   |
help: Rewrite as `age == JediOrder.YODA`
   |
12 | YODA >= age  # SIM300
   - JediOrder.YODA == age  # SIM300
13 + age == JediOrder.YODA  # SIM300
14 | 0 < (number - 100)  # SIM300
   |

SIM300 [*] Yoda condition detected
  --> SIM300.py:14:1
   |
12 | YODA >= age  # SIM300
13 | JediOrder.YODA == age  # SIM300
14 | 0 < (number - 100)  # SIM300
   | ^^^^^^^^^^^^^^^^^^
15 | B<A[0][0]or B
16 | B or(B)<A[0][0]
   |
help: Rewrite as `(number - 100) > 0`
   |
13 | JediOrder.YODA == age  # SIM300
   - 0 < (number - 100)  # SIM300
14 + (number - 100) > 0  # SIM300
15 | B<A[0][0]or B
   |

SIM300 [*] Yoda condition detected
  --> SIM300.py:15:1
   |
13 | JediOrder.YODA == age  # SIM300
14 | 0 < (number - 100)  # SIM300
15 | B<A[0][0]or B
   | ^^^^^^^^^
16 | B or(B)<A[0][0]
17 | {"non-empty-dict": "is-ok"} == DummyHandler.CONFIG
   |
help: Rewrite as `A[0][0] > B`
   |
14 | 0 < (number - 100)  # SIM300
   - B<A[0][0]or B
15 + A[0][0] > B or B
16 | B or(B)<A[0][0]
   |

SIM300 [*] Yoda condition detected
  --> SIM300.py:16:5
   |
14 | 0 < (number - 100)  # SIM300
15 | B<A[0][0]or B
16 | B or(B)<A[0][0]
   |     ^^^^^^^^^^^
17 | {"non-empty-dict": "is-ok"} == DummyHandler.CONFIG
   |
help: Rewrite as `A[0][0] > (B)`
   |
15 | B<A[0][0]or B
   - B or(B)<A[0][0]
16 + B or A[0][0] > (B)
17 | {"non-empty-dict": "is-ok"} == DummyHandler.CONFIG
   |

SIM300 [*] Yoda condition detected
  --> SIM300.py:17:1
   |
15 | B<A[0][0]or B
16 | B or(B)<A[0][0]
17 | {"non-empty-dict": "is-ok"} == DummyHandler.CONFIG
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18 |
19 | # Errors in preview
   |
help: Rewrite as `DummyHandler.CONFIG == {"non-empty-dict": "is-ok"}`
   |
16 | B or(B)<A[0][0]
   - {"non-empty-dict": "is-ok"} == DummyHandler.CONFIG
17 + DummyHandler.CONFIG == {"non-empty-dict": "is-ok"}
18 |
   |

SIM300 [*] Yoda condition detected
  --> SIM300.py:20:1
   |
19 | # Errors in preview
20 | ['upper'] == UPPER_LIST
   | ^^^^^^^^^^^^^^^^^^^^^^^
21 | {} == DummyHandler.CONFIG
   |
help: Rewrite as `UPPER_LIST == ['upper']`
   |
19 | # Errors in preview
   - ['upper'] == UPPER_LIST
20 + UPPER_LIST == ['upper']
21 | {} == DummyHandler.CONFIG
   |

SIM300 [*] Yoda condition detected
  --> SIM300.py:21:1
   |
19 | # Errors in preview
20 | ['upper'] == UPPER_LIST
21 | {} == DummyHandler.CONFIG
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
22 |
23 | # Errors in stable
   |
help: Rewrite as `DummyHandler.CONFIG == {}`
   |
20 | ['upper'] == UPPER_LIST
   - {} == DummyHandler.CONFIG
21 + DummyHandler.CONFIG == {}
22 |
   |
