A condition combines more && and || operators than the configured maximum
What it finds
A long chain of && and || hides which combination of cases it accepts. Naming parts of it, in variables or methods, makes each part checkable on its own. The maximum is the parameter max_operators, 4 by default.
From the rule's source, complex_condition.rs.
class Rules{ bool Allowed(bool a, bool b, bool c, bool d, bool e, bool f) { var simple = a && b || c; return a && b || c && (d || e) && f;tx0 reports: this condition has 5 && and || operators, more than 4 }} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/csharp:complex-condition" = "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/csharp:complex-condition] reason="..."tx0 explain tx0/csharp:complex-condition shows the same in the terminal. Found a false positive? Report it.