-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
fixesRelated to suggested fixes for violationsRelated to suggested fixes for violations
Description
Trying to reformat firefox code with ruff https://phabricator.services.mozilla.com/D223851#inline-1243679
we noticed a bug with collapsible-else-if - https://docs.astral.sh/ruff/rules/collapsible-else-if/#collapsible-else-if-plr5501
take this case:
def check_sign(value: int) -> None:
if value > 0:
print("Number is positive.")
else:
# my comment to explain this
# but will be removed
if value < 0:
print("Number is negative.")
else:
print("Number is zero.")
Then, with ruff main (ec72e67)
cargo run -p ruff -- check --select PLR5501 foo.py --no-cache --fix
Found 1 error (1 fixed, 0 remaining).
will update the code to:
def check_sign(value: int) -> None:
if value > 0:
print("Number is positive.")
elif value < 0:
print("Number is negative.")
else:
print("Number is zero.")
which removed my comment
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
fixesRelated to suggested fixes for violationsRelated to suggested fixes for violations