This rule raises an issue when strings or bytes are concatenated implicitly.
Python concatenates adjacent string or byte literals at compile time. It means that "a" "b" is equivalent to "ab". This
is sometimes used to split a long string on multiple lines. However an implicit string concatenation can also be very confusing. In the following
contexts it might indicate that a comma was forgotten:
def func():
return "item1" "item2" # Noncompliant: a comma is missing to return a tuple.
["1" # Noncompliant: a comma is missing.
"2",
"a very" # Noncompliant: a "+" is missing.
"long string"]
def func():
return "item1", "item2"
["1",
"2",
"a very" +
"long string"]
This rule will not raise any issues when there is a visible reason for the string concatenation:
\n.