Skip to main content

Module change_coupling

Module change_coupling 

Source
Expand description

Change coupling and change dispersion from the commits of the churn pass.

Change dispersion is the number of files and lines in the commits that touch a file. Change coupling is a pair of files that change together in many commits. A coupled pair is hidden when no static edge (an import or a re-export chain) connects the two files, so an agent that reads the import graph cannot find the second file.

The thresholds follow the Code Maat defaults: a file needs 5 revisions, a pair needs 5 shared revisions and a coupling degree of at least 30%, and a commit that touches more than 30 files is a bulk commit and is skipped.

Structs§

ChangeCouplingSettings
Thresholds for change coupling.
ChangeHistoryAnalysis
Result of one pass over the commit history.
CoChangeGap
A changed file whose hidden change-coupling partner is not in the change.
CoChangePair
A pair of files that change together. path_a sorts before path_b.
FileDispersion
Change dispersion of one file.
PairScope
Scope filters for hidden pairs: health.ignore, the workspace filter, and an optional diff.
StaticLinkIndex
Static edges between analyzed files, for the hidden-pair check.

Constants§

DEFAULT_MAX_FILES_PER_COMMIT
Default maximum number of analyzed files in one commit. A larger commit is a bulk change (a rename, a format pass, a dependency bump) and creates pairs that are not real coupling.
DEFAULT_MIN_DEGREE
Default minimum coupling degree, as a ratio in [0, 1].
DEFAULT_MIN_REVISIONS
Default minimum number of commits for each file of a pair.
DEFAULT_MIN_SHARED_REVISIONS
Default minimum number of commits that change both files of a pair.
STRONG_COUPLING_DEGREE
Coupling degree at or above which a hidden pair is strong. A strong pair becomes a refactoring target.

Functions§

analyze_change_history
Analyze change dispersion and hidden change coupling over commits.
co_change_gaps
Hidden pairs with exactly one file in changed. Sorted by degree and then shared revisions (both descending), then by changed file and partner, so a cap keeps the strongest gaps.
health_ignore_set
Compile the health.ignore globs that PairScope applies.