/** * Complexity trend for hotspots (change: add-complexity-trend-signal). * * Current complexity is a snapshot: a function at 20 for two years and one that climbed 8 → 20 last * month look the same. For a bounded set of hotspots — functions at or above * {@link HIGH_COMPLEXITY_THRESHOLD} in files with recorded churn — this re-parses the file at the * last few non-merge, non-bulk commits that touched it (`git show :`, the same * extractor and complexity estimator analyze uses) and labels the sequence: * * rising — never decreases and ends higher than it started * falling — never increases and ends lower than it started * flat — every sample equal * mixed — went both ways * * No score, no threshold on the size of a change. The label is withheld when fewer than * {@link MIN_TREND_POINTS} samples exist (shallow history, or a function newer than the window). * A function that is rising and at or above the threshold in its latest sample is a * `declining-health` finding (advisory). Paths are matched exactly: git does not follow renames. */ import { type FunctionNode } from '../../analyzer/call-graph.js'; import type { GovernanceFinding } from './enforcement-policy.js'; /** Commits sampled per hotspot file, newest first. */ export declare const TREND_SAMPLES = 4; /** Fewest samples a label is drawn from: two points are a difference, not a trend. */ export declare const MIN_TREND_POINTS = 3; /** Most hotspot files sampled per call: each costs one `git log` and up to {@link TREND_SAMPLES} re-parses. */ export declare const MAX_TREND_FILES = 10; export type ComplexityTrend = 'rising' | 'falling' | 'flat' | 'mixed'; export interface FunctionComplexityTrend { name: string; file: string; /** Oldest first; `commit` is the short SHA. */ samples: Array<{ commit: string; complexity: number; }>; trend?: ComplexityTrend; /** Why no trend is given. */ withheld?: 'shallow-history' | 'history-unavailable'; } export interface ComplexityTrendReport { hotspots: FunctionComplexityTrend[]; /** Hotspot functions not sampled because of the file cap. */ notSampled: number; caveats: string[]; } export declare const COMPLEXITY_TREND_CAVEATS: string[]; /** The label for a sequence, oldest first; undefined below {@link MIN_TREND_POINTS}. */ export declare function trendOf(values: readonly number[]): ComplexityTrend | undefined; /** * Trends for the hotspots among `nodes`: complexity at or above the threshold, in a file in * `churnedFiles`, highest complexity first, at most `limit` functions from {@link MAX_TREND_FILES} files. */ export declare function computeComplexityTrends(root: string, nodes: readonly FunctionNode[], churnedFiles: ReadonlySet, limit: number): Promise; /** One advisory `declining-health` finding per hotspot that is rising and high in its latest sample. */ export declare function decliningHealthFindings(report: ComplexityTrendReport): GovernanceFinding[]; //# sourceMappingURL=complexity-trend.d.ts.map