pub struct ComplexityContribution {
pub line: u32,
pub col: u32,
pub metric: ComplexityMetric,
pub kind: ComplexityContributionKind,
pub weight: u16,
pub nesting: u16,
pub literal_membership: bool,
}Expand description
A single complexity increment, located at its source line/column.
weight is the amount this construct added to metric; for nested
cognitive increments weight == 1 + nesting. Consumers that render inline
(the VS Code editor breakdown) group contributions by line and sum the
weights, deferring the per-kind list to a hover.
Fields§
§line: u321-based line number where the construct begins.
col: u320-based byte column where the construct begins.
metric: ComplexityMetricWhich metric this increment contributes to.
kind: ComplexityContributionKindThe syntactic construct responsible for the increment.
weight: u16The amount added to metric at this site (1 + nesting for nested
cognitive increments, otherwise 1).
nesting: u16The nesting depth at the increment site (0 when not nested). Lets a
consumer explain a cognitive +3 as “+1 base, +2 nesting”.
literal_membership: boolThis cyclomatic || increment is part of a literal membership chain:
strict equality checks of one identifier against primitive literals
(kind === "a" || kind === "b"). The literal-membership value of
health.cyclomaticPolicy removes these increments from the effective
cyclomatic value. Omitted when false, and always false under the
default standard policy.