yapf
yapf copied to clipboard
Adjacent string literals of the same type should be on separate lines
Suppose I have:
print("Line 1\n"
"Line 2\n"
"Line 3\n")
yapf (0.31.0) wants to format it as:
print("Line 1\n" "Line 2\n" "Line 3\n")
I argue that this is clearly against the author's intention, and having adjacent string literals of the same type (i.e., both are unadorned double-quoted strings, both are unadorned single-quoted strings, both are raw strings, both are f-strings...) makes no sense since they could have been combined into a single string literal in that case.
If that reasoning isn't compelling enough, then alternatively check if a string literal ends with a \n, and never put an adjacent string literal to the right of it.