HealthScoreCalculator

Computes a 0–100 architecture health score for each module.

The score is a weighted composite of four signals:

SignalWeightRationale
Instability index30%Measures how dependent vs depended-upon a module is
God module status25%High fan-in AND fan-out = hard to change, hard to test
Cycle participation25%Cycles prevent independent builds and refactoring
Transitive dep count20%Proxy for hidden coupling and build-time impact

A score of 100 means: stable, no coupling hotspot, not in any cycle, few transitive deps. A score below 40 is a strong signal that the module needs architectural attention.

projectScore computes a separate whole-project score from project-level signals (cycles, violations, coupling hubs, average instability). The two are deliberately different measures and are never interchangeable: a project of uniformly healthy modules can still score poorly if they are tangled together. Both are single-sourced here so the report, the CSV, and the docs cannot drift apart.

Both scores are intentionally non-configurable - their value comes from being a consistent signal across projects, not a team-specific threshold.

Functions

Link copied to clipboard
fun projectScore(summary: GraphSummary, errorCount: Int, warningCount: Int): ProjectHealth

Returns the whole-project health score - a different measure from the per-module score.

Link copied to clipboard
fun score(path: String, graph: ModuleDependencyGraph, cycleNodes: Set<String>): Int

Returns a health score in 0, 100 for the given module path. Higher is healthier.