UNPKG

agentsqripts

Version:

Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems

34 lines (28 loc) 993 B
/** * @file Complexity level determination * @description Determines overall complexity level based on metrics */ /** * Determines overall complexity level based on metrics * @param {Object} metrics - Code metrics object * @returns {string} Complexity level (LOW, MEDIUM, HIGH, CRITICAL) */ function determineComplexityLevel(metrics) { const { cyclomaticComplexity, cognitiveComplexity, linesOfCode, functionCount, nestingDepth } = metrics; // Critical indicators if (cyclomaticComplexity > 25 || cognitiveComplexity > 30 || linesOfCode > 1000) { return 'CRITICAL'; } // High complexity indicators if (cyclomaticComplexity > 15 || cognitiveComplexity > 20 || linesOfCode > 500 || functionCount > 20) { return 'HIGH'; } // Medium complexity indicators if (cyclomaticComplexity > 10 || cognitiveComplexity > 15 || linesOfCode > 250 || functionCount > 10) { return 'MEDIUM'; } return 'LOW'; } module.exports = { determineComplexityLevel };