Expand description
Language-neutral complexity-metric scaffolding: the computed-value carrier
FileMetrics, the writer write_metrics (omit-at + LOC/Halstead gating),
the no-signal values [metric_omit_at], and the metric attribute catalog
metric_specs. The sibling coupling_specs lives
alongside it; both are merged into the snapshot’s node-attribute dictionary.
The per-language engines that produce a FileMetrics live in the language
crates — rust_ts in code-ranker-plugin-rust, python_ts in
code-ranker-plugin-python, ecmascript_ts in code-ranker-ecmascript-core.
Each plugin computes a FileMetrics with its own engine and calls
write_metrics here. This module names no language and pulls in no grammar.
Structs§
- File
Metrics - The per-file complexity metric values a language engine computes, in the
canonical key set this crate writes. Engines fill the fields they support and
leave the rest at
0.0(e.g.tlocis non-zero only for Rust, where inline#[cfg(test)]items are stripped).write_metricsturns this into node attributes, applying each key’somit_atand the LOC / Halstead gating.
Functions§
- metric_
specs - The complexity metric attribute dictionary and its groups, fully enriched
(label/name/short/description/formula/calc/direction) so the UI hardcodes no
metric. The orchestrator merges these into each level’s
node_attributes/attribute_groups(then prunes to keys actually present) and overlays language thresholds. Coupling/cycle specs live incode-ranker-graph. - write_
metrics - Write the metric attributes for one file node from a computed
FileMetrics. Each value is dropped at itsomit_at([metric_omit_at]); the LOC block is gated onsloc > 0and the Halstead block onvolume > 0. The same omit values are published on the specs (metric_specs), so emission and the declared spec never drift. Called by each language plugin after its engine produces the values.