mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-30 08:23:53 +00:00
431 B
431 B
if-with-same-arms (SIM114)
Derived from the flake8-simplify linter.
What it does
Checks for if
branches with identical arm bodies.
Why is this bad?
If multiple arms of an if
statement have the same body, using or
better signals the intent of the statement.
Example
if x = 1:
print("Hello")
elif x = 2:
print("Hello")
Use instead:
if x = 1 or x = 2
print("Hello")