-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations
Description
plr5501-testcase.py
class Class:
def can_do_thing(self, thing) -> bool:
if self.thing_id == thing.id:
return True
if self.x:
if self.y.z(thing):
return True
else:
# This comment should not be eaten by automated fixes,
# because it explains important context about the next if block.
# I would be quite sad if it vanished, because I'm quite fond of it.
if self.thing.color == thing.color_id:
return True
return Falseruff --select=PLR5501 --isolated --diff plr5501-testcase.py
--- plr5501-testcase.py
+++ plr5501-testcase.py
@@ -5,10 +5,6 @@
if self.x:
if self.y.z(thing):
return True
- else:
- # This comment should not be eaten by automated fixes,
- # because it explains important context about the next if block.
- # I would be quite sad if it vanished, because I'm quite fond of it.
- if self.thing.color == thing.color_id:
- return True
+ elif self.thing.color == thing.color_id:
+ return True
return FalseOther info
- Ruff 0.2.0 on a Mac.
- I really, really liked that comment. 😭
- I guess the best thing to do is to move the comment inside the
elif?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations