flake8-simplify
flake8-simplify copied to clipboard
[Adjust Rule] SIM300 false positive with literals on both sides
Desired change
- Rule(s): SIM300
- Adjustment: Don't trigger if both sides of a comparison are literals
Explanation
These comparisons are pointless, but swapping them around (only to be told to swap them around again after) is also pointless.
Example
Example 1
if "a" == "b":
pass
SIM300: Use '"b" == "a"' instead of '"a" == "b"' (Yoda-conditions)
Example 2
if 1 == 2:
pass
SIM300: Use '2 == 1' instead of '1 == 2' (Yoda-conditions)