Expand description
Architectural metrics: coupling, cycles, layering, hubs.
Extracted pure algorithms and supporting types for architecture analysis.
Report structs and OutputFormatter impls live in the normalize crate.
Structs§
- Coupling
AndHubs - Result of coupling and hub detection.
- Cross
Import - Bidirectional coupling between two modules.
- Cycle
- A circular dependency cycle.
- HubModule
- Hub module (high fan-in AND high fan-out). These are architectural bottlenecks — everything flows through them.
- Import
Chain - A deep import chain (longest dependency path).
- Import
Graph - Import graph: maps of who imports whom and who is imported by whom.
- Layer
Flow - Import flow between directory layers. Shows which directories import from which, helping identify layer violations.
- Layering
Module Result - Per-module layering metrics returned by
compute_layering_compliance. - Module
Coupling - Coupling metrics for a module (file).
- Orphan
Module - Orphan module (never imported).
- Symbol
Metrics - Symbol-level metrics.
Functions§
- build_
import_ graph - Build an import graph from the index.
- compute_
coupling_ and_ hubs - Compute coupling metrics and hub modules from the import graph.
- compute_
depth - Compute depth for a single node via DFS + memoization. depth(M) = max(1 + depth(importer) for importer in importers_by_file[M]), base 0.
- compute_
downstream - Compute downstream count for a node: BFS through importers_by_file.
- compute_
layer_ flows - Compute import flows between directory layers.
- compute_
layering_ compliance - Classify imports for each module as downward, upward, or self-layer.
- detect_
cross_ imports - Detect bidirectional coupling between module pairs.
- extract_
layer - Extract the layer (top-level directory) from a file path. Returns the first significant directory component.
- find_
cycles - Find cycles in the import graph using iterative DFS.
- find_
longest_ chains - Find the longest import chains (dependency paths) in the graph.
- find_
orphan_ modules - Find modules that have no importers (and are not entry-point files).
- find_
symbol_ hotspots - Find symbols imported from many places (symbol hotspots).