UNPKG

agentsqripts

Version:

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

60 lines (57 loc) 2.71 kB
/** * @file Type-specific recommendation provider for targeted complexity improvement guidance * @description Single responsibility: Generate specialized recommendations tailored to specific complexity indicator types * * This provider implements targeted recommendation generation that recognizes different complexity * indicators require different remediation approaches and strategies. It serves as a knowledge * base that translates specific complexity patterns into actionable, contextualized guidance * for development teams seeking systematic code quality improvements. * * Design rationale: * - Type-specific recommendations provide targeted guidance for different complexity patterns * - Contextual advice addresses root causes rather than symptoms of complexity issues * - Specialized guidance leverages domain expertise for maximum improvement effectiveness * - Priority-based recommendations help teams focus efforts on highest-impact improvements * - Actionable advice provides concrete steps beyond generic complexity reduction suggestions * * Recommendation specialization framework: * - Cyclomatic complexity: Control flow simplification and conditional logic improvements * - Cognitive complexity: Nesting reduction and readability enhancement strategies * - Technical debt: Systematic debt reduction and code quality improvement approaches * - Structural complexity: Architecture improvements and modular design enhancements * - Maintainability: Long-term sustainability and code evolution strategies */ /** * Gets type-specific recommendation * @param {string} type - Indicator type * @param {number} count - Number of occurrences * @returns {Object|null} Recommendation */ function getTypeSpecificRecommendation(type, count) { const recommendations = { long_parameter_list: { priority: 'MEDIUM', action: 'Refactor functions with long parameter lists', description: `${count} function(s) have too many parameters. Use object parameters or split functions.` }, long_line: { priority: 'LOW', action: 'Break long lines', description: `${count} line(s) exceed recommended length. Break for better readability.` }, magic_numbers: { priority: 'LOW', action: 'Extract magic numbers to constants', description: `${count} instance(s) of magic numbers found. Extract to named constants.` }, code_duplication: { priority: 'MEDIUM', action: 'Remove code duplication', description: `Code duplication detected. Extract common patterns into reusable functions.` } }; return recommendations[type] || null; } module.exports = { getTypeSpecificRecommendation };