-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
ruff version: 0.0.275
ISC003 gives false positive depending on order of concatenation.
First Case (succeeds)
# a.py
a = "foo"
b = a + "." + "bar"$ ruff check --isolated --select ISC a.py
Second case (fails)
# b.py
a = "foo"
b = "bar" + "." + a$ ruff check --isolated --select ISC b.py
b.py:3:5: ISC003 Explicitly concatenated string should be implicitly concatenated
Found 1 error.I would expect both cases to succeed.
Extra third case
# c.py
a = "foo" + "bar"$ ruff check --isolated --select ISC c.py
c.py:1:5: ISC003 Explicitly concatenated string should be implicitly concatenated
Found 1 error.I (personally) would also expect this to succeed. My reading of the ISC003 docs is that this is aimed at string literals that wrap over multiple lines. Which all the above cases are not.
The codebase I'm dealing with has a lot of instances of "foo" + "bar", mainly for clarity reasons, and I don't want those instances flagged. However I do still want this to be raised for multiline strings.
If flagging "foo" + "bar" is the intended behaviour, could this perhaps be made configurable? i.e. allowing single line instances like that to be ignored while still flagging the multiline cases.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers