Skip to main content

Crate code_ranker_complexity

Crate code_ranker_complexity 

Source
Expand description

Central, language-agnostic complexity pass. Given a structural graph whose file nodes carry their absolute path as id, this reads each file, picks a rust-code-analysis parser by extension, and writes the metrics into the node’s attrs as flat keys. It is the single place that knows rust-code-analysis; plugins emit structure only.

The metric attribute dictionary it can produce is exposed via metric_specs so the orchestrator can declare it in the snapshot.

Functions§

annotate
Annotate every file node (kind == "file") whose id is a readable source file of a known extension with complexity metrics. Returns the number of nodes annotated. Nodes whose file cannot be read/parsed are left untouched.
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 in code-ranker-graph.