-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
bugSomething isn't workingSomething isn't workingneeds-designNeeds further design before implementationNeeds further design before implementation
Description
Summary
While reviewing #17454 just after reviewing #18075, I realized that the split-static-string (SIM905) fix breaks when **kwargs are passed to split:
> cat <<EOF | ruff check --select SIM905 --diff -
d = {"sep": ","}
"a,b,c,d".split(**{"sep": ","})
"a,b,c,d".split(**d)
EOF
@@ -1,4 +1,4 @@
d = {"sep": ","}
-"a,b,c,d".split(**{"sep": ","})
-"a,b,c,d".split(**d)
+["a,b,c,d"]
+["a,b,c,d"]
Would fix 2 errors.The same code in Python produces ['a', 'b', 'c', 'd'] instead of ['a,b,c,d'].
I think the root cause here is that find_argument_value doesn't (or possibly can't) resolve the starred argument, so this might affect any rule that uses it.
Shoutout to @vjurczenia whose careful dict handling in #17454 brought this to my attention.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneeds-designNeeds further design before implementationNeeds further design before implementation