Two string literals on one line are joined into one item of a list or call
What it finds
["read", "write" "admin"]: two string literals next to each other are joined into one, so the list has two items, "read" and "writeadmin". In a list, tuple, set or argument list, where the other items are separated by commas, that is almost always a missing comma.
Reported are items made of string literals joined on one line, in a collection or argument list with at least one other item. Literals joined across lines, the usual way to split a long string, are left alone.
From the rule's source, implicit_concatenation.rs.
def roles(user, log): names = ["read", "write" "admin"]tx0 reports: these two strings are joined into one item; a comma may be missing between them log("user", "action" "done")tx0 reports: these two strings are joined into one item message = ("a long message that is split " "across two lines") single = ["only" "one"] return names, message, single, ["x", f"{user}" "y"]tx0 reports: these two strings are joined Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:implicit-concatenation" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:implicit-concatenation] reason="..."tx0 explain tx0/python:implicit-concatenation shows the same in the terminal. Found a false positive? Report it.