UNPKG

agentsqripts

Version:

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

40 lines (33 loc) 1.11 kB
/** * @file Get context-aware recommendations * @description Single responsibility: Generate recommendations based on file contexts */ function getContextAwareRecommendations(duplicateGroup, fileContexts) { const recommendations = []; // Check if all files are test files const allTestFiles = duplicateGroup.blocks.every(block => fileContexts[block.file]?.isTestFile ); if (allTestFiles) { recommendations.push({ type: 'TEST_HELPER', suggestion: 'Consider extracting to a shared test helper or fixture file', priority: 'LOW' }); } // Check for mixed contexts const contexts = duplicateGroup.blocks.map(block => fileContexts[block.file]?.fileType ); const uniqueContexts = [...new Set(contexts)]; if (uniqueContexts.length > 1) { recommendations.push({ type: 'CROSS_CONTEXT', suggestion: 'Code is duplicated across different contexts (test/source/config)', priority: 'HIGH', warning: 'This might indicate a design issue' }); } return recommendations; } module.exports = getContextAwareRecommendations;