Skip to main content

Convert Implicit String Concat Inside Sequence into Individual Elements

pixee:python/str-concat-in-sequence-literals

ImportanceReview GuidanceRequires Scanning Tool
MediumMerge After Cursory ReviewNo

This codemod fixes cases of implicit string concatenation inside lists, sets, or tuples. This is most likely a mistake: you probably meant include a comma in between the concatenated strings.

Our changes look something like this:

bad = [
- "ab"
+ "ab",
"cd",
"ef",
- "gh"
+ "gh",
"ij",
]

If you have feedback on this codemod, please let us know!

F.A.Q.

Why is this codemod marked as Merge After Cursory Review?

While string concatenation inside a sequence iterable is likely a mistake, there are instances when you may choose to use them..

Codemod Settings

N/A

References

N/A