RegionAnalyzer

Groups modules into regions, so a project too large to read module-by-module can be read region-by-region.

Beyond a couple of hundred modules a node-link diagram stops being a picture of an architecture and becomes a picture of a hairball. The fix is not a better layout - it is to draw fewer things: fifteen regions and the flows between them, with the modules one click away.

Grouping follows a declared-first cascade, taking the first source that yields a usable partition:

  1. layers { } - the architecture the build enforces

  2. teams { } - the architecture the organisation enforces

  3. module path prefixes - the architecture the directory tree implies

  4. community detection - what the dependency edges themselves say

The cascade matters for honesty as much as quality: a partition from a declared source is an observed fact, while one from prefixes or detection is an inference, and the report says which. Pure functions - no I/O, deterministic tie-breaks throughout.

Functions

Link copied to clipboard
fun analyze(graph: ModuleDependencyGraph, layers: List<LayerSpec> = emptyList(), teams: Map<String, List<String>> = emptyMap()): RegionMap

Groups graph into regions.