A case of a switch has more lines of code than the limit

tx0/java:long-casestrictwarningmaintainability

What it finds

A case with a long body hides the shape of its switch: the other cases scroll out of sight while one is read. A method for the body keeps the switch a table of choices.

Counted are the lines of code after a label, up to the next label. A case above the parameter max-lines, 20 by default, is reported at its label.

From the rule's source, long_case.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:

tx0.toml
[rules]
"tx0/java:long-case" = "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/java:long-case] reason="..."

tx0 explain tx0/java:long-case shows the same in the terminal. Found a false positive? Report it.