Module modularity_violations
Expand description
modularity-violations analysis — file pairs that co-change
(Fisher-significant) yet have NO structural import edge between
them.
This is the “implicit cross-module dependency” of Kazman & Cai’s DV8 hotspot patterns (Mo, Cai, Kazman, Xiao 2015 Hotspot Patterns): two files that change together but don’t import each other are coupled through something invisible — a shared global, a leaky abstraction, a contract honoured through a third party. Empirically these pairs are more bug- and change-prone than structurally-coupled ones.
§Fusion — the two graphs CodeLore already builds
- Temporal:
coupling::run_couplingFisher-significant co-change pairs. - Structural: the import graph
(
import_graph) with transitive reachability.
A modularity violation is a co-change pair with no directed dependency path between the two files in either direction — neither (transitively) imports the other. That is the “co-change ∧ ¬structurally-connected” cell of the structure×history matrix that neither an import-only graph (it has no history) nor a history-only tool (it has no structure) can populate.
§Scope & limits
- Transitive. A pair coupled through an import chain
(
a → b → c, withaandcco-changing) is not a violation —adoes depend onc, just not directly. Only pairs with no path between them are flagged. Files with no resolved imports aren’t graph nodes, so any co-change with them is (correctly) a violation. - Resolver language coverage. Connectivity relies on the resolved
imports.target_path, populated for Rust + Python + JS/TS. Languages whose resolver leavestarget_pathNULL (e.g. Java) make real import edges look absent, so such repos over-report. Same caveatgod_classesdocuments for fan-in.
Structs§
- Modularity
Violation Row - A single modularity violation: a Fisher-significant co-change pair with no structural import edge. Carries the co-change evidence so callers can rank and explain the finding.
Functions§
- run_
modularity_ violations - Run the
modularity-violationsanalysis. Returns the Fisher-significant co-change pairs that have no structural import edge, ranked by coupling degree (highest first — inherited fromrun_coupling’s ordering).