A statement carries a label for a break or continue that jumps out of nested loops
What it finds
A labeled break or continue jumps across several levels of loops at once, which makes the flow hard to follow. Moving the inner loop into a method that returns usually says the same more plainly.
Reported is every labeled statement.
From the rule's source, labeled_statement.rs.
class Search { void find(int[][] grid) { outer:tx0 reports: a label for jumps across loops for (int[] row : grid) { for (int cell : row) { if (cell == 0) { break outer; } } } }} 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/java:labeled-statement" = "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:labeled-statement] reason="..."tx0 explain tx0/java:labeled-statement shows the same in the terminal. Found a false positive? Report it.