A boolean expression joins more conditions with && and || than the limit
What it finds
A boolean expression joined by many && and || is hard to read and to get right; a few well-named variables or a method for part of it make the intent clear.
The operators of one expression are counted through parentheses, up to a lambda, a method call or anything else that starts a new expression. Expressions with more than the parameter max operators, 4 by default, are reported once, at the outermost operator.
From the rule's source, long_condition.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/java:long-boolean-expression" = "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-boolean-expression] reason="..."tx0 explain tx0/java:long-boolean-expression shows the same in the terminal. Found a false positive? Report it.