Skip to main content

Module modularity_violations

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

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, with a and c co-changing) is not a violation — a does depend on c, 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 leaves target_path NULL (e.g. Java) make real import edges look absent, so such repos over-report. Same caveat god_classes documents for fan-in.

Structs§

ModularityViolationRow
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-violations analysis. Returns the Fisher-significant co-change pairs that have no structural import edge, ranked by coupling degree (highest first — inherited from run_coupling’s ordering).