get_coupling_metrics
Compute Robert C. Martin coupling metrics (Ca, Ce, I, A, D) for modules to identify those too concrete-and-stable or too abstract-and-unstable.
Instructions
Compute Robert C. Martin package-level coupling metrics per module: afferent coupling (Ca), efferent coupling (Ce), instability (I = Ce/(Ca+Ce)), abstractness (A = abstract_classes/total_classes), and distance from the main sequence (D = |A+I-1|). Modules with high distance are either too concrete-and-stable or too abstract-and-unstable.
No prior indexing required.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo_path | Yes | Path to the repository | |
| module_filter | No | Restrict to modules whose label starts with this prefix | |
| top_n | No | Limit output to the top N modules sorted by distance from the main sequence (default: 20, max: 500) | |
| include_leaves | No | Include modules with zero efferent coupling (default: false, excludes pure leaf modules) | |
| summary_only | No | Return only stats without individual module metrics (default: false) | |
| exclude_tests | No | Exclude test modules from metrics (default: true) |