sicua
Version:
A tool for analyzing project structure and dependencies
176 lines (175 loc) • 5.68 kB
TypeScript
/**
* Scoring criteria and weights for component analysis
* Defines how different metrics contribute to the overall problematic score
* Focus on "easily overlooked" issues that developers miss
*/
export interface ScoringWeights {
cyclomaticComplexity: number;
cognitiveComplexity: number;
couplingDegree: number;
maintainabilityIndex: number;
reactComplexity: number;
containerComplexity: number;
errorHandlingGaps: number;
typeIssues: number;
componentFlowComplexity: number;
zombieCode: number;
circularDependencies: number;
translationIssues: number;
seoProblems: number;
accessibilityIssues: number;
performanceIssues: number;
deduplicationOpportunities: number;
codeMetrics: number;
magicNumbers: number;
}
export interface ScoringThresholds {
highCyclomaticComplexity: number;
highCognitiveComplexity: number;
lowMaintainabilityIndex: number;
highCouplingDegree: number;
lowCodeToCommentRatio: number;
highMagicNumberCount: number;
highAnyUsage: number;
highComplexTypeCount: number;
highConditionalRenderCount: number;
deepComponentNesting: number;
criticalSeoIssues: number;
missingSeoMeta: number;
poorImageOptimization: number;
missingAltTexts: number;
missingAriaLabels: number;
poorSemanticStructure: number;
largeBundleSize: number;
missingLazyLoading: number;
blockingResources: number;
highMissingTranslations: number;
highSimilarityScore: number;
}
export interface ScoringMultipliers {
inCircularDependency: number;
noErrorHandlingForRiskyOps: number;
hasAnyType: number;
criticalSeoMissing: number;
criticalAccessibilityMissing: number;
hasProperErrorHandling: number;
hasGoodTypeAnnotations: number;
lowComplexity: number;
goodSeoImplementation: number;
goodAccessibilityImplementation: number;
}
/**
* Rebalanced scoring weights focusing on architectural and maintainability issues
* that actually make components problematic in real Next.js/React projects
*/
export declare const DEFAULT_SCORING_WEIGHTS: ScoringWeights;
/**
* Updated thresholds focusing on architectural complexity
*/
export declare const DEFAULT_SCORING_THRESHOLDS: ScoringThresholds;
/**
* Updated scoring multipliers with focus on architectural issues
*/
export declare const DEFAULT_SCORING_MULTIPLIERS: ScoringMultipliers;
/**
* Updated file type exclusions with better page component handling
*/
export declare const FILE_TYPE_EXCLUSIONS: {
readonly constants: {
readonly excludeMetrics: readonly ["magicNumbers", "codeMetrics", "deduplicationOpportunities", "componentFlowComplexity", "seoProblems", "accessibilityIssues"];
readonly reduceWeights: {
readonly typeIssues: 0.3;
readonly translationIssues: 0.1;
};
};
readonly config: {
readonly excludeMetrics: readonly ["magicNumbers", "componentFlowComplexity", "translationIssues", "seoProblems", "accessibilityIssues"];
readonly reduceWeights: {
readonly typeIssues: 0.5;
readonly codeMetrics: 0.3;
};
};
readonly types: {
readonly excludeMetrics: readonly ["componentFlowComplexity", "seoProblems", "accessibilityIssues", "performanceIssues", "errorHandlingGaps"];
readonly increaseWeights: {
readonly typeIssues: 2.5;
};
};
readonly utility: {
readonly increaseWeights: {
readonly errorHandlingGaps: 1.5;
readonly typeIssues: 1.4;
readonly cyclomaticComplexity: 1.2;
};
readonly reduceWeights: {
readonly seoProblems: 0.1;
readonly accessibilityIssues: 0.1;
};
};
readonly component: {
readonly increaseWeights: {
readonly cyclomaticComplexity: 1.3;
readonly cognitiveComplexity: 1.3;
readonly couplingDegree: 1.2;
readonly componentFlowComplexity: 1.4;
};
readonly reduceWeights: {
readonly seoProblems: 0.3;
};
};
readonly hook: {
readonly increaseWeights: {
readonly errorHandlingGaps: 1.4;
readonly typeIssues: 1.3;
readonly cyclomaticComplexity: 1.2;
};
readonly reduceWeights: {
readonly couplingDegree: 0.7;
readonly seoProblems: 0.1;
readonly accessibilityIssues: 0.1;
};
};
readonly page: {
readonly increaseWeights: {
readonly cyclomaticComplexity: 1.8;
readonly cognitiveComplexity: 1.8;
readonly couplingDegree: 1.5;
readonly componentFlowComplexity: 1.6;
readonly errorHandlingGaps: 1.3;
};
readonly reduceWeights: {
readonly seoProblems: 0.2;
readonly accessibilityIssues: 0.4;
readonly translationIssues: 0.8;
};
};
};
/**
* Score ranges for categorizing issues
*/
export declare const SCORE_RANGES: {
readonly CRITICAL: {
readonly min: 80;
readonly max: 100;
};
readonly HIGH: {
readonly min: 60;
readonly max: 79;
};
readonly MEDIUM: {
readonly min: 40;
readonly max: 59;
};
readonly LOW: {
readonly min: 20;
readonly max: 39;
};
readonly MINIMAL: {
readonly min: 0;
readonly max: 19;
};
};
/**
* Enhanced file type detection with more specific categorization
*/
export declare function getFileType(componentName: string, fullPath: string): keyof typeof FILE_TYPE_EXCLUSIONS;