sicua
Version:
A tool for analyzing project structure and dependencies
90 lines (89 loc) • 2.99 kB
TypeScript
/**
* Updated scoring aggregator with file type exclusions and new metrics
* Combines multiple metric scores into a final component score
* Applies weights, multipliers, and file type adjustments
*/
import { ScoringWeights, ScoringMultipliers, FILE_TYPE_EXCLUSIONS } from "./ScoringCriteria";
import { MetricCalculationContext } from "./ScoringMetrics";
export interface IndividualScores {
circularDependencies: number;
errorHandlingGaps: number;
cyclomaticComplexity: number;
cognitiveComplexity: number;
maintainabilityIndex: number;
typeIssues: number;
accessibilityIssues: number;
performanceIssues: number;
seoProblems: number;
couplingDegree: number;
zombieCode: number;
translationIssues: number;
componentFlowComplexity: number;
deduplicationOpportunities: number;
codeMetrics: number;
magicNumbers: number;
reactComplexity: number;
containerComplexity: number;
}
export interface ScoringResult {
finalScore: number;
individualScores: IndividualScores;
appliedMultipliers: string[];
fileType: keyof typeof FILE_TYPE_EXCLUSIONS;
weightedContributions: Record<keyof IndividualScores, number>;
excludedMetrics: string[];
appliedWeightAdjustments: Record<string, number>;
}
export declare class ScoringAggregator {
private weights;
private multipliers;
constructor(weights?: ScoringWeights, multipliers?: ScoringMultipliers);
/**
* Calculate the final score for a component with file type exclusions
*/
calculateScore(context: MetricCalculationContext): ScoringResult;
/**
* Calculate all individual metric scores including new React-specific metrics
*/
private calculateIndividualScores;
/**
* Apply file type exclusions to remove inappropriate metrics
*/
private applyFileTypeExclusions;
/**
* Apply file type specific weight adjustments with renormalization
*/
private applyFileTypeAdjustments;
/**
* Calculate weighted score using adjusted weights including new metrics
*/
private calculateWeightedScore;
/**
* Calculate weighted contributions for each metric including new metrics
*/
private calculateWeightedContributions;
/**
* Apply multipliers based on critical conditions with file type awareness
*/
private applyMultipliers;
/**
* Check if component has proper error handling
*/
private hasProperErrorHandling;
/**
* Check if component has good type annotations
*/
private hasGoodTypeAnnotations;
/**
* NEW: Check if component has good SEO implementation
*/
private hasGoodSeoImplementation;
/**
* NEW: Check if component has good accessibility implementation
*/
private hasGoodAccessibilityImplementation;
/**
* Get a breakdown of the scoring for debugging/analysis with file type info
*/
getScoreBreakdown(result: ScoringResult): string;
}