Language-agnostic Cognitive (SonarSource) and Cyclomatic (McCabe) complexity.
This crate computes complexity over a normalized intermediate representation
([ir::Node]) instead of any particular language's AST. A language adapter
(such as cccc-typescript) lowers its parse tree into Vec<ir::Node>, and
[engine::analyze] scores it. All scoring rules live here, so adding a
language means writing an adapter — not reimplementing the metrics.
use Node;
use analyze;
// `if (cond) {}` inside `fn f` — one cognitive point, cyclomatic base 1 + 1.
let f = Function ;
let report = analyze;
assert_eq!;
assert_eq!;