A case of a switch has more lines of code than the configured maximum
What it finds
A case of a switch or select whose body runs over many lines buries the structure of the switch: the cases are hard to compare, and the next case is far away. Moving the body into a function gives it a name and keeps the switch readable.
The length is counted in lines of code of the statements after the colon, as for function length: lines with at least one token. The maximum is the parameter max_lines, 30 by default.
From the rule's source, long_case_clause.rs.
Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/go:long-case-clause" = "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/go:long-case-clause] reason="..."tx0 explain tx0/go:long-case-clause shows the same in the terminal. Found a false positive? Report it.