pub struct FunctionComplexity {Show 13 fields
pub name: String,
pub is_private_member: bool,
pub line: u32,
pub col: u32,
pub cyclomatic: u16,
pub cognitive: u16,
pub line_count: u32,
pub param_count: u8,
pub react_hook_count: u16,
pub react_jsx_max_depth: u16,
pub react_prop_count: u16,
pub source_hash: Option<String>,
pub contributions: Vec<ComplexityContribution>,
}Expand description
Complexity metrics for a single function/method/arrow.
Fields§
§name: StringFunction name (or "<anonymous>" for unnamed functions/arrows).
is_private_member: boolWhether this function is an ECMAScript #-private class member.
Kept separately from name because a public string-named method may
legally begin with # and remains eligible for runtime coverage.
line: u321-based line number where the function starts.
col: u320-based byte column where the function starts.
cyclomatic: u16McCabe cyclomatic complexity (1 + decision points).
cognitive: u16SonarSource cognitive complexity (structural + nesting penalty).
line_count: u32Number of lines in the function body.
param_count: u8Number of parameters (excluding TypeScript’s this parameter).
react_hook_count: u16Number of React hook calls (useState / useEffect / useMemo /
useCallback / custom use*) made directly in this function’s body.
Non-zero only for React components/hooks; descriptive context surfaced in
the hotspot drill-down, never a tunable threshold (anti-numerology).
react_jsx_max_depth: u16Maximum JSX element nesting depth reached in this function’s body (the
deepest chain of element-inside-element). 0 when the function renders
no JSX. Descriptive context surfaced in the hotspot drill-down, never a
tunable threshold (anti-numerology).
react_prop_count: u16Number of props destructured from this component’s first parameter (the
{ a, b, c } props object). 0 for non-component functions and for
components taking a bare props identifier (not statically countable).
Descriptive context surfaced in the hotspot drill-down, never a tunable
threshold (anti-numerology).
source_hash: Option<String>Content digest of the function’s full-span source slice.
contributions: Vec<ComplexityContribution>Per-decision-point breakdown explaining WHICH constructs drove the
cyclomatic and cognitive scores. One entry per increment event (an if
emits one cyclomatic and one cognitive entry at the same line, because
the two metrics accrue at different granularities). Always computed and
cached; surfaced in JSON only behind health --complexity-breakdown.