A function has more independent paths through it than the configured maximum
What it finds
Every branch doubles what a reader and a test must consider. Past a point a function has more paths than anyone checks, and splitting it into named steps makes each one testable on its own.
The complexity is one plus the number of decision points in the function, function literals included: each if, for, case and communication clause other than default, and each && and ||. That is the cyclomatic complexity of the function, counted on its syntax. The maximum is the parameter max_complexity, 20 by default.
From the rule's source, high_complexity.rs.
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/go:high-complexity" = "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/go:high-complexity] reason="..."tx0 explain tx0/go:high-complexity shows the same in the terminal. Found a false positive? Report it.