UNPKG

agentsqripts

Version:

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

29 lines (23 loc) 857 B
/** * @file Estimate refactoring effort * @description Single responsibility: Calculate effort required for refactoring */ function estimateRefactoringEffort(blocks, strategy) { const fileCount = new Set(blocks.map(b => b.file)).size; const totalLines = blocks.reduce((sum, b) => sum + (b.endLine - b.startLine + 1), 0); // Base effort calculation let effort = 'LOW'; if (fileCount > 5 || totalLines > 200) { effort = 'HIGH'; } else if (fileCount > 2 || totalLines > 50) { effort = 'MEDIUM'; } // Adjust based on strategy complexity if (strategy === 'EXTRACT_BASE_CLASS' || strategy === 'EXTRACT_SHARED_MODULE') { // These are more complex refactorings if (effort === 'LOW') effort = 'MEDIUM'; if (effort === 'MEDIUM') effort = 'HIGH'; } return effort; } module.exports = estimateRefactoringEffort;