implicit-str-concat / W1404#
Implicit string concatenation found in %s
String literals are implicitly concatenated in a literal iterable definition : maybe a comma is missing ?
x = ["a" "b"] # [implicit-str-concat]
with open("hello.txt" "r") as f: # [implicit-str-concat] print(f.read())
x = ["a", "b"]
with open("hello.txt", "r") as f: print(f.read())
By default, detection of implicit string concatenation of line jumps is disabled. Hence the following code will not trigger this rule:
SEQ = ('a', 'b' 'c')
In order to detect this case, you must enable check-str-concat-over-line-jumps:
[STRING_CONSTANT] check-str-concat-over-line-jumps = true
However, the drawback of this setting is that it will trigger false positive for string parameters passed on multiple lines in function calls:
warnings.warn( "rotate() is deprecated and will be removed in a future release. " "Use the rotation() context manager instead.", DeprecationWarning, stacklevel=3, )
No message will be emitted, though, if you clarify the wanted concatenation with parentheses:
warnings.warn( ( "rotate() is deprecated and will be removed in a future release. " "Use the rotation() context manager instead." ), DeprecationWarning, stacklevel=3, )
Created by the string checker.