-
Notifications
You must be signed in to change notification settings - Fork 2k
Detect and prevent implicit string concatenations e.g. lists #13031
Copy link
Copy link
Closed
Labels
needs-decisionAwaiting a decision from a maintainerAwaiting a decision from a maintainerruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
A typical error I (and colleagues) run into is as follows:
mylist = ["a", "b" "c"]
# results in:
mylist # ['a', 'bc']
# as opposed to the intended ["a", "b", "c"]
While this pattern is often well known, this pattern can often lead to unintended side effects, which are hard to track and detect.
This suggestion is in line with pep3126 (which was rejected due to "the feature to be removed isn’t all that harmful").
I have searched existing ruff rules and only found the ISC rules, which do not cover this pattern. The proposed pattern is in line with some of the ISC rules (ISC001), while I would say it disagrees with (ISC003)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
needs-decisionAwaiting a decision from a maintainerAwaiting a decision from a maintainerruleImplementing or modifying a lint ruleImplementing or modifying a lint rule