Coverage Complexity and Change Risk Metrics

  26 May 2026   1 min read

Wallaby’s Coverage tab now helps you prioritize testing and refactoring work by highlighting files where complex code and lower coverage combine to create higher maintenance risk.

The updated Coverage tab adds Complexity and Change Risk columns. Complexity shows the file’s cyclomatic complexity, calculated as 1 + decision points for each function. Decision points include branches such as if statements, loops, switch cases, ternaries, and short-circuit logic.

Change Risk combines complexity with Wallaby coverage, making it easier to sort for files where extra coverage may have the biggest payoff.

The Change Risk score is calculated as:

Change Risk = CC² × (1 - coverage)³ + CC

In the formula, CC is cyclomatic complexity and coverage is Wallaby coverage from 0 to 1. Higher scores indicate code that combines higher complexity with lower test coverage. Fully covered files still show their underlying complexity, because at 100% coverage the score is equal to the file’s cyclomatic complexity.