UNPKG

agentsqripts

Version:

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

45 lines (39 loc) 1.27 kB
/** * @file Infer required parameters from differences * @description Single responsibility: Determine parameters needed for extracted function */ function inferRequiredParameters(blocks, differences) { const parameters = []; // Convert differences to parameters if (differences.variables.size > 0) { // For each unique variable, create a parameter let paramCount = 0; differences.variables.forEach(variable => { if (paramCount < 3) { // Limit parameters for readability parameters.push({ name: `param${paramCount + 1}`, type: 'any', // Would be inferred from usage in real implementation description: `Replaces varying value: ${variable}` }); paramCount++; } }); } if (differences.literals.size > 0 && parameters.length < 3) { parameters.push({ name: 'options', type: 'object', description: 'Configuration options for varying literals' }); } // If no differences, might still need context parameter if (parameters.length === 0 && blocks.length > 1) { parameters.push({ name: 'context', type: 'object', description: 'Execution context' }); } return parameters; } module.exports = inferRequiredParameters;