A condition combines more && and || operators than the configured maximum
What it finds
A condition with many operators is hard to read and to get right; naming parts of it with variables or functions says what each part means. Counts the operators of the outermost Boolean expression. The maximum is the parameter max, 4 by default.
From the rule's source, boolean_complexity.rs.
fun valid(a: Boolean, b: Boolean, c: Boolean, d: Boolean, e: Boolean, f: Boolean): Boolean { if (a && b || c && d || e && f) return truetx0 reports: the condition has 5 && and || operators, more than 4 return a && (b || c)} 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/kotlin:complex-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/kotlin:complex-boolean-expression] reason="..."tx0 explain tx0/kotlin:complex-boolean-expression shows the same in the terminal. Found a false positive? Report it.