Skip to main content

Crate normalize_architecture

Crate normalize_architecture 

Source
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§

CouplingAndHubs
Result of coupling and hub detection.
CrossImport
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.
ImportChain
A deep import chain (longest dependency path).
ImportGraph
Import graph: maps of who imports whom and who is imported by whom.
LayerFlow
Import flow between directory layers. Shows which directories import from which, helping identify layer violations.
LayeringModuleResult
Per-module layering metrics returned by compute_layering_compliance.
ModuleCoupling
Coupling metrics for a module (file).
OrphanModule
Orphan module (never imported).
SymbolMetrics
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).