agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
25 lines (21 loc) • 689 B
JavaScript
/**
* @file Extract function calls from code
* @description Single responsibility: Extract function call names from a line of code
*/
/**
* Extract function calls from a line of code
*/
function extractFunctionCalls(line) {
const calls = [];
const functionPattern = /(\w+)\s*\(/g;
let match;
while ((match = functionPattern.exec(line)) !== null) { // eslint-disable-line eqeqeq
const funcName = match[1];
// Skip common built-ins and array methods
if (!['console', 'parseInt', 'parseFloat', 'Object', 'Array', 'Math', 'for', 'if', 'while'].includes(funcName)) {
calls.push(funcName);
}
}
return calls;
}
module.exports = extractFunctionCalls;