import type { SyntaxNode } from '../types.js'; import type { SupportedLanguage } from '../languages/registry.js'; /** Raw Halstead counts from AST */ export interface HalsteadCounts { n1: number; n2: number; N1: number; N2: number; operators: Map; operands: Map; } /** Calculated Halstead metrics */ export interface HalsteadMetrics { vocabulary: number; length: number; volume: number; difficulty: number; effort: number; time: number; bugs: number; } /** * Count operators and operands in an AST node * * @param node - AST node to analyze (typically a function/method) * @param language - Programming language for language-specific handling * @returns HalsteadCounts with raw operator/operand counts */ export declare function countHalstead(node: SyntaxNode, language: SupportedLanguage): HalsteadCounts; /** * Calculate derived Halstead metrics from raw counts * * Formulas based on Maurice Halstead's "Elements of Software Science" (1977): * - Vocabulary (n) = n1 + n2 * - Length (N) = N1 + N2 * - Volume (V) = N × log₂(n) - size of implementation * - Difficulty (D) = (n1/2) × (N2/n2) - error-proneness * - Effort (E) = D × V - mental effort required * - Time (T) = E / 18 - seconds to understand (Stroud number) * - Bugs (B) = E^(2/3) / 3000 - estimated delivered bugs (effort-based variant) * * @param counts - Raw Halstead counts from countHalstead() * @returns Calculated HalsteadMetrics */ export declare function calculateHalsteadMetrics(counts: HalsteadCounts): HalsteadMetrics; /** * Calculate Halstead metrics for an AST node in one call * * Convenience function that combines countHalstead and calculateHalsteadMetrics. * * @param node - AST node to analyze * @param language - Programming language * @returns Calculated HalsteadMetrics */ export declare function calculateHalstead(node: SyntaxNode, language: SupportedLanguage): HalsteadMetrics; //# sourceMappingURL=halstead.d.ts.map