agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
20 lines (18 loc) • 556 B
JavaScript
/**
* @file Context extraction
* @description Gets context around a line for complexity estimation
*/
/**
* Get context around a line for complexity estimation
* @param {Array} lines - Array of file lines
* @param {number} lineIndex - Index of the target line
* @returns {string} Context around the line
*/
function getContextAroundLine(lines, lineIndex) {
const start = Math.max(0, lineIndex - 2);
const end = Math.min(lines.length, lineIndex + 10);
return lines.slice(start, end).join('\n');
}
module.exports = {
getContextAroundLine
};