-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
a = "sjdfaskldjfakljklfoo"
if a.endswith("foo"):
a = a[: -len("foo")]
print(a)should be transformed to
a = "sjdfaskldjfakljklfoo"
a = a.removesuffx("foo")
print(a)when FURB188 is enabled. Other similar trivial cases are caught as seen by the changes I made in PyTorch for pytorch/pytorch#146997 so I assume it's an error in the rule logic where some corner case is not properly handled.
Ruff version is ruff 0.9.6
Command is ruff check --select=FURB188 --target-version py39 test_FURB188.py
Interestingly:
a = "sjdfaskldjfakljklfoo"
suffix = "foo"
if a.endswith(suffix):
a = a[: -len(suffix)]
print(a)is properly flagged currently. Therefore, ruff only this issue with string literals, and only for suffixes accessed in this pattern interestingly enough.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working