UNPKG

aetherlight-analyzer

Version:

Code analysis tool to generate ÆtherLight sprint plans from any codebase

85 lines 2.99 kB
/** * DESIGN DECISION: Cyclomatic complexity analysis with refactoring recommendations * WHY: High complexity = harder to maintain, more bugs, longer onboarding time * * REASONING CHAIN: * 1. Extract complexity scores from parsed functions/methods * 2. Calculate statistics (average, median, max, percentiles) * 3. Identify functions exceeding threshold (>15 by default) * 4. Generate complexity heatmap by file * 5. Recommend refactorings (Extract Method, Split Class, etc.) * 6. Result: Clear prioritization of technical debt reduction * * PATTERN: Pattern-ANALYZER-001 (AST-Based Code Analysis) * RELATED: TypeScript Parser (calculates complexity), Rust Parser * PERFORMANCE: <1s for 100k LOC */ import { ParseResult } from '../parsers/types'; import { ComplexityAnalysis, AnalyzerResult, Issue } from './types'; export declare class ComplexityAnalyzer { private complexityThreshold; constructor(complexityThreshold?: number); /** * Analyze complexity of parsed codebase * * DESIGN DECISION: Extract complexity from parser results, no re-parsing * WHY: TypeScript parser already calculated complexity - reuse work */ analyze(parseResult: ParseResult): AnalyzerResult; /** * Extract complexity scores from all functions/methods */ private extractComplexityScores; /** * Calculate statistical measures * * DESIGN DECISION: Median more useful than average for skewed distributions * WHY: One 100-complexity function shouldn't skew average */ private calculateStatistics; /** * Identify functions exceeding complexity threshold * * REASONING CHAIN: * 1. Find all functions with complexity > threshold * 2. Sort by complexity (highest first) * 3. Generate refactoring recommendations * 4. Prioritize by complexity × LOC (bigger impact) */ private identifyHighComplexityFunctions; /** * Generate refactoring recommendation based on complexity level */ private generateRefactoringRecommendation; /** * Generate complexity heatmap by file * * DESIGN DECISION: File-level aggregation for sprint planning * WHY: Sprint tasks operate on files, not individual functions */ private generateComplexityHeatmap; /** * Generate issues for high-complexity functions * * DESIGN DECISION: Convert complexity analysis to generic Issue format * WHY: Enables aggregation with other analyzer results */ generateIssues(analysis: ComplexityAnalysis): Issue[]; /** * Map complexity to severity */ private getSeverity; /** * Estimate refactoring effort based on complexity */ private getEffort; /** * Estimate impact of refactoring */ private getImpact; /** * Generate summary report */ generateSummaryReport(analysis: ComplexityAnalysis): string; } //# sourceMappingURL=complexity-analyzer.d.ts.map