Two string literals in a list of strings are joined into one element, probably for want of a comma
What it finds
{ "red", "green" "blue", "white" }: adjacent string literals are joined into one, so a missing comma in a list of strings makes one element of two and the list one shorter than it looks.
The list must hold at least four strings and nothing else, exactly one of them written as two literals on separate lines, as the elements around it are.
From the rule's source, string_list_missing_comma.rs.
static const char *colors[] = { "red", "green" "blue",tx0 reports: this string is joined to the one before it "white", "black",}; static const char *help[] = { "usage: tool [options]", " -v verbose", " -q quiet", " -h " "help",}; 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/c:string-list-missing-comma" = "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/c:string-list-missing-comma] reason="..."tx0 explain tx0/c:string-list-missing-comma shows the same in the terminal. Found a false positive? Report it.