-
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 violationshelp wantedContributions especially welcomeContributions especially welcome
Description
Summary
The list produced for rsplit by split-static-string (SIM905) is the reverse of what it should be.
$ cat >sim905.py <<'# EOF'
print("a,b".rsplit(","))
# EOF
$ python sim905.py
['a', 'b']
$ ruff --isolated check sim905.py --select SIM905 --fix
Found 1 error (1 fixed, 0 remaining).
$ cat sim905.py
print(["b", "a"])
$ python sim905.py
['b', 'a']This is because the fix is implemented with Rust’s str::rsplit and str::rsplitn, which return iterators over the string in reverse, unlike Python’s str.rsplit.
Version
ruff 0.11.9 (2370297 2025-05-09)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violationshelp wantedContributions especially welcomeContributions especially welcome