agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
810 lines (809 loc) • 30.6 kB
JSON
{
"timestamp": "2025-07-31T21:52:58.691Z",
"summary": {
"totalFiles": 100,
"filesAnalyzed": 100,
"filesWithIssues": 9,
"totalIssues": 15,
"totalEffort": 38,
"performanceScore": 93,
"projectScore": 93,
"projectGrade": "A",
"performanceGrade": "A",
"categoryBreakdown": {
"Algorithm": 11,
"Concurrency": 3,
"CPU": 1
},
"severityBreakdown": {
"HIGH": 11,
"MEDIUM": 4,
"LOW": 0
}
},
"files": [
{
"file": "../cli/analyze-cleanup.js",
"issues": [
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-cleanup.js:231-244",
"line": 244,
"outerLoop": 231,
"innerLoop": 244,
"code": "options.extensions = rawExtensions.map(ext => ext.trim());",
"description": "Nested iteration creating O(n²) complexity: for (let i = 0; i < args.length; i++) {... → options.extensions = rawExtensions.map(e...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
}
],
"performanceScore": 100,
"metrics": {
"totalIssues": 1,
"score": 100,
"grade": "A",
"totalEffort": 3,
"categoryBreakdown": {
"Algorithm": 1
},
"severityBreakdown": {
"HIGH": 1,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 1,
"score": 100,
"grade": "A",
"totalEffort": 3,
"categoryBreakdown": {
"Algorithm": 1
},
"severityBreakdown": {
"HIGH": 1,
"MEDIUM": 0,
"LOW": 0
}
}
},
{
"file": "../cli/analyze-security.js",
"issues": [
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-security.js:150-160",
"line": 160,
"outerLoop": 150,
"innerLoop": 160,
"code": "fileAnalysis.vulnerabilities = fileAnalysis.vulnerabilities.filter(vuln => {",
"description": "Nested iteration creating O(n²) complexity: results.fileAnalysis.vulnerabilities = r... → fileAnalysis.vulnerabilities = fileAnaly...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-security.js:171-172",
"line": 172,
"outerLoop": 171,
"innerLoop": 172,
"code": "file.vulnerabilities.map(vuln => ({ ...vuln, file: file.file }))",
"description": "Nested iteration creating O(n²) complexity: const allVulns = results.projectAnalysis... → file.vulnerabilities.map(vuln => ({ ...v...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-security.js:350-356",
"line": 356,
"outerLoop": 350,
"innerLoop": 356,
"code": ".map(([severity, count]) => ` ${severity}: ${count}`);",
"description": "Nested iteration creating O(n²) complexity: analysis.vulnerabilities.forEach(vuln =>... → .map(([severity, count]) => ` ${severi...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
}
],
"performanceScore": 99,
"metrics": {
"totalIssues": 3,
"score": 99,
"grade": "A",
"totalEffort": 9,
"categoryBreakdown": {
"Algorithm": 3
},
"severityBreakdown": {
"HIGH": 3,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 3,
"score": 99,
"grade": "A",
"totalEffort": 9,
"categoryBreakdown": {
"Algorithm": 3
},
"severityBreakdown": {
"HIGH": 3,
"MEDIUM": 0,
"LOW": 0
}
}
},
{
"file": "../cli/analyze-wet-code.js",
"issues": [
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-wet-code.js:209-219",
"line": 219,
"outerLoop": 209,
"innerLoop": 219,
"code": "const lineRanges = group.blocks.slice(0, 5).map(b => `${b.startLine}-${b.endLine}`);",
"description": "Nested iteration creating O(n²) complexity: filteredGroups.forEach((group, i) => {... → const lineRanges = group.blocks.slice(0,...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
}
],
"performanceScore": 100,
"metrics": {
"totalIssues": 1,
"score": 100,
"grade": "A",
"totalEffort": 3,
"categoryBreakdown": {
"Algorithm": 1
},
"severityBreakdown": {
"HIGH": 1,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 1,
"score": 100,
"grade": "A",
"totalEffort": 3,
"categoryBreakdown": {
"Algorithm": 1
},
"severityBreakdown": {
"HIGH": 1,
"MEDIUM": 0,
"LOW": 0
}
}
},
{
"file": "../cli/promote-exports.js",
"issues": [
{
"type": "serial_await",
"severity": "MEDIUM",
"category": "Concurrency",
"location": "../cli/promote-exports.js:272-273",
"line": 272,
"code": "const indexPath = await getIndexFile(directory, options);\nconst indexResult = await updateIndexFile(indexPath, promotionResult.promoted, promotionResult.filePath, { dryRun });",
"description": "Consecutive awaits that could run concurrently",
"summary": "Consecutive awaits that could run concurrently",
"recommendation": "Consider Promise.all if operations are independent",
"effort": 1,
"impact": "50–70% latency reduction for grouped ops",
"estimatedSavings": "50-70% latency reduction"
}
],
"performanceScore": 100,
"metrics": {
"totalIssues": 1,
"score": 100,
"grade": "A",
"totalEffort": 1,
"categoryBreakdown": {
"Concurrency": 1
},
"severityBreakdown": {
"HIGH": 0,
"MEDIUM": 1,
"LOW": 0
}
},
"summary": {
"totalIssues": 1,
"score": 100,
"grade": "A",
"totalEffort": 1,
"categoryBreakdown": {
"Concurrency": 1
},
"severityBreakdown": {
"HIGH": 0,
"MEDIUM": 1,
"LOW": 0
}
}
},
{
"file": "../lib/export-promotion/projectRefactoringAnalyzer.js",
"issues": [
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../lib/export-promotion/projectRefactoringAnalyzer.js:34-49",
"line": 49,
"outerLoop": 34,
"innerLoop": 49,
"code": "const allDirectories = new Set(sourceFiles.map(f => path.dirname(f)));",
"description": "Nested iteration creating O(n²) complexity: const analysisPromises = sourceFiles.map... → const allDirectories = new Set(sourceFil...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../lib/export-promotion/projectRefactoringAnalyzer.js:51-53",
"line": 53,
"outerLoop": 51,
"innerLoop": 53,
"code": "Promise.all(indexFiles.map(indexFile => analyzeIndexFile(indexFile)))",
"description": "Nested iteration creating O(n²) complexity: const indexFilePromises = Array.from(all... → Promise.all(indexFiles.map(indexFile => ...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../lib/export-promotion/projectRefactoringAnalyzer.js:69-84",
"line": 84,
"outerLoop": 69,
"innerLoop": 84,
"code": "for (const opp of r.promotionOpportunities) {",
"description": "Nested iteration creating O(n²) complexity: const filesWithOpportunities = results.f... → for (const opp of r.promotionOpportuniti...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../lib/export-promotion/projectRefactoringAnalyzer.js:83-84",
"line": 84,
"outerLoop": 83,
"innerLoop": 84,
"code": "for (const opp of r.promotionOpportunities) {",
"description": "Nested iteration creating O(n²) complexity: for (const r of results) {... → for (const opp of r.promotionOpportuniti...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
}
],
"performanceScore": 98,
"metrics": {
"totalIssues": 4,
"score": 98,
"grade": "A",
"totalEffort": 12,
"categoryBreakdown": {
"Algorithm": 4
},
"severityBreakdown": {
"HIGH": 4,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 4,
"score": 98,
"grade": "A",
"totalEffort": 12,
"categoryBreakdown": {
"Algorithm": 4
},
"severityBreakdown": {
"HIGH": 4,
"MEDIUM": 0,
"LOW": 0
}
}
},
{
"file": "../lib/frontend-backend/backendEndpointExtractor.js",
"issues": [
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../lib/frontend-backend/backendEndpointExtractor.js:78-80",
"line": 80,
"outerLoop": 78,
"innerLoop": 80,
"code": "while ((match = pattern.exec(content)) !== null) {",
"description": "Nested iteration creating O(n²) complexity: for (const pattern of patterns) {... → while ((match = pattern.exec(content)) !...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
}
],
"performanceScore": 100,
"metrics": {
"totalIssues": 1,
"score": 100,
"grade": "A",
"totalEffort": 3,
"categoryBreakdown": {
"Algorithm": 1
},
"severityBreakdown": {
"HIGH": 1,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 1,
"score": 100,
"grade": "A",
"totalEffort": 3,
"categoryBreakdown": {
"Algorithm": 1
},
"severityBreakdown": {
"HIGH": 1,
"MEDIUM": 0,
"LOW": 0
}
}
},
{
"file": "../lib/frontend-backend/frontendCallExtractor.js",
"issues": [
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../lib/frontend-backend/frontendCallExtractor.js:68-70",
"line": 70,
"outerLoop": 68,
"innerLoop": 70,
"code": "while ((match = pattern.exec(content)) !== null) {",
"description": "Nested iteration creating O(n²) complexity: for (const pattern of patterns) {... → while ((match = pattern.exec(content)) !...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
}
],
"performanceScore": 100,
"metrics": {
"totalIssues": 1,
"score": 100,
"grade": "A",
"totalEffort": 3,
"categoryBreakdown": {
"Algorithm": 1
},
"severityBreakdown": {
"HIGH": 1,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 1,
"score": 100,
"grade": "A",
"totalEffort": 3,
"categoryBreakdown": {
"Algorithm": 1
},
"severityBreakdown": {
"HIGH": 1,
"MEDIUM": 0,
"LOW": 0
}
}
},
{
"file": "../lib/performance/inefficientRegexDetector.js",
"issues": [
{
"type": "inefficient_regex",
"severity": "MEDIUM",
"category": "CPU",
"location": "../lib/performance/inefficientRegexDetector.js:35",
"line": 35,
"code": "return line.includes('[') && line.includes('-') && line.includes('].test(');",
"issue": "complex character class in global test",
"description": "Inefficient regex: complex character class in global test",
"summary": "Inefficient regex: complex character class in global test",
"recommendation": "Optimize regex pattern, use string methods, or compile once and reuse",
"effort": 2,
"impact": "20–50% CPU reduction in string processing",
"estimatedSavings": "20-50% CPU reduction in string processing"
}
],
"performanceScore": 100,
"metrics": {
"totalIssues": 1,
"score": 100,
"grade": "A",
"totalEffort": 2,
"categoryBreakdown": {
"CPU": 1
},
"severityBreakdown": {
"HIGH": 0,
"MEDIUM": 1,
"LOW": 0
}
},
"summary": {
"totalIssues": 1,
"score": 100,
"grade": "A",
"totalEffort": 2,
"categoryBreakdown": {
"CPU": 1
},
"severityBreakdown": {
"HIGH": 0,
"MEDIUM": 1,
"LOW": 0
}
}
},
{
"file": "../lib/performance/serialAwaitDetector.js",
"issues": [
{
"type": "serial_await",
"severity": "MEDIUM",
"category": "Concurrency",
"location": "../lib/performance/serialAwaitDetector.js:52",
"line": 52,
"code": "if (currentLine.includes('await ') && nextLine.includes('await ') &&",
"awaitCount": 2,
"description": "Multiple awaits in serial — not batched for concurrent execution",
"summary": "Multiple awaits in serial — not batched for concurrent execution",
"recommendation": "Wrap in Promise.all/Promise.allSettled to enable concurrent execution",
"effort": 1,
"impact": "50–70% latency reduction for grouped ops",
"estimatedSavings": "50-70% latency reduction for grouped ops"
},
{
"type": "serial_await",
"severity": "MEDIUM",
"category": "Concurrency",
"location": "../lib/performance/serialAwaitDetector.js:2-3",
"line": 2,
"code": "* Serial await detector\n* Detects serial await patterns that could be parallelized",
"description": "Consecutive awaits that could run concurrently",
"summary": "Consecutive awaits that could run concurrently",
"recommendation": "Consider Promise.all if operations are independent",
"effort": 1,
"impact": "50–70% latency reduction for grouped ops",
"estimatedSavings": "50-70% latency reduction"
}
],
"performanceScore": 99,
"metrics": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 2,
"categoryBreakdown": {
"Concurrency": 2
},
"severityBreakdown": {
"HIGH": 0,
"MEDIUM": 2,
"LOW": 0
}
},
"summary": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 2,
"categoryBreakdown": {
"Concurrency": 2
},
"severityBreakdown": {
"HIGH": 0,
"MEDIUM": 2,
"LOW": 0
}
}
}
],
"issues": [
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-cleanup.js:231-244",
"line": 244,
"outerLoop": 231,
"innerLoop": 244,
"code": "options.extensions = rawExtensions.map(ext => ext.trim());",
"description": "Nested iteration creating O(n²) complexity: for (let i = 0; i < args.length; i++) {... → options.extensions = rawExtensions.map(e...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-security.js:150-160",
"line": 160,
"outerLoop": 150,
"innerLoop": 160,
"code": "fileAnalysis.vulnerabilities = fileAnalysis.vulnerabilities.filter(vuln => {",
"description": "Nested iteration creating O(n²) complexity: results.fileAnalysis.vulnerabilities = r... → fileAnalysis.vulnerabilities = fileAnaly...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-security.js:171-172",
"line": 172,
"outerLoop": 171,
"innerLoop": 172,
"code": "file.vulnerabilities.map(vuln => ({ ...vuln, file: file.file }))",
"description": "Nested iteration creating O(n²) complexity: const allVulns = results.projectAnalysis... → file.vulnerabilities.map(vuln => ({ ...v...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-security.js:350-356",
"line": 356,
"outerLoop": 350,
"innerLoop": 356,
"code": ".map(([severity, count]) => ` ${severity}: ${count}`);",
"description": "Nested iteration creating O(n²) complexity: analysis.vulnerabilities.forEach(vuln =>... → .map(([severity, count]) => ` ${severi...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-wet-code.js:209-219",
"line": 219,
"outerLoop": 209,
"innerLoop": 219,
"code": "const lineRanges = group.blocks.slice(0, 5).map(b => `${b.startLine}-${b.endLine}`);",
"description": "Nested iteration creating O(n²) complexity: filteredGroups.forEach((group, i) => {... → const lineRanges = group.blocks.slice(0,...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "serial_await",
"severity": "MEDIUM",
"category": "Concurrency",
"location": "../cli/promote-exports.js:272-273",
"line": 272,
"code": "const indexPath = await getIndexFile(directory, options);\nconst indexResult = await updateIndexFile(indexPath, promotionResult.promoted, promotionResult.filePath, { dryRun });",
"description": "Consecutive awaits that could run concurrently",
"summary": "Consecutive awaits that could run concurrently",
"recommendation": "Consider Promise.all if operations are independent",
"effort": 1,
"impact": "50–70% latency reduction for grouped ops",
"estimatedSavings": "50-70% latency reduction"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../lib/export-promotion/projectRefactoringAnalyzer.js:34-49",
"line": 49,
"outerLoop": 34,
"innerLoop": 49,
"code": "const allDirectories = new Set(sourceFiles.map(f => path.dirname(f)));",
"description": "Nested iteration creating O(n²) complexity: const analysisPromises = sourceFiles.map... → const allDirectories = new Set(sourceFil...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../lib/export-promotion/projectRefactoringAnalyzer.js:51-53",
"line": 53,
"outerLoop": 51,
"innerLoop": 53,
"code": "Promise.all(indexFiles.map(indexFile => analyzeIndexFile(indexFile)))",
"description": "Nested iteration creating O(n²) complexity: const indexFilePromises = Array.from(all... → Promise.all(indexFiles.map(indexFile => ...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../lib/export-promotion/projectRefactoringAnalyzer.js:69-84",
"line": 84,
"outerLoop": 69,
"innerLoop": 84,
"code": "for (const opp of r.promotionOpportunities) {",
"description": "Nested iteration creating O(n²) complexity: const filesWithOpportunities = results.f... → for (const opp of r.promotionOpportuniti...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../lib/export-promotion/projectRefactoringAnalyzer.js:83-84",
"line": 84,
"outerLoop": 83,
"innerLoop": 84,
"code": "for (const opp of r.promotionOpportunities) {",
"description": "Nested iteration creating O(n²) complexity: for (const r of results) {... → for (const opp of r.promotionOpportuniti...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../lib/frontend-backend/backendEndpointExtractor.js:78-80",
"line": 80,
"outerLoop": 78,
"innerLoop": 80,
"code": "while ((match = pattern.exec(content)) !== null) {",
"description": "Nested iteration creating O(n²) complexity: for (const pattern of patterns) {... → while ((match = pattern.exec(content)) !...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../lib/frontend-backend/frontendCallExtractor.js:68-70",
"line": 70,
"outerLoop": 68,
"innerLoop": 70,
"code": "while ((match = pattern.exec(content)) !== null) {",
"description": "Nested iteration creating O(n²) complexity: for (const pattern of patterns) {... → while ((match = pattern.exec(content)) !...",
"summary": "True nested iteration pattern creating O(n²) complexity",
"recommendation": "Use hash maps, sets, or single-pass algorithms to reduce complexity",
"effort": 3,
"impact": "40–80% latency reduction",
"estimatedSavings": "40-80% latency reduction"
},
{
"type": "inefficient_regex",
"severity": "MEDIUM",
"category": "CPU",
"location": "../lib/performance/inefficientRegexDetector.js:35",
"line": 35,
"code": "return line.includes('[') && line.includes('-') && line.includes('].test(');",
"issue": "complex character class in global test",
"description": "Inefficient regex: complex character class in global test",
"summary": "Inefficient regex: complex character class in global test",
"recommendation": "Optimize regex pattern, use string methods, or compile once and reuse",
"effort": 2,
"impact": "20–50% CPU reduction in string processing",
"estimatedSavings": "20-50% CPU reduction in string processing"
},
{
"type": "serial_await",
"severity": "MEDIUM",
"category": "Concurrency",
"location": "../lib/performance/serialAwaitDetector.js:52",
"line": 52,
"code": "if (currentLine.includes('await ') && nextLine.includes('await ') &&",
"awaitCount": 2,
"description": "Multiple awaits in serial — not batched for concurrent execution",
"summary": "Multiple awaits in serial — not batched for concurrent execution",
"recommendation": "Wrap in Promise.all/Promise.allSettled to enable concurrent execution",
"effort": 1,
"impact": "50–70% latency reduction for grouped ops",
"estimatedSavings": "50-70% latency reduction for grouped ops"
},
{
"type": "serial_await",
"severity": "MEDIUM",
"category": "Concurrency",
"location": "../lib/performance/serialAwaitDetector.js:2-3",
"line": 2,
"code": "* Serial await detector\n* Detects serial await patterns that could be parallelized",
"description": "Consecutive awaits that could run concurrently",
"summary": "Consecutive awaits that could run concurrently",
"recommendation": "Consider Promise.all if operations are independent",
"effort": 1,
"impact": "50–70% latency reduction for grouped ops",
"estimatedSavings": "50-70% latency reduction"
}
],
"recommendations": [
"PRIORITY: Address 11 high-impact performance issues first",
"High optimization effort required (38 points) - prioritize by impact/effort ratio",
"Focus on algorithmic optimizations for maximum performance impact",
"Leverage Promise.all/Promise.allSettled for parallel execution"
],
"analysisTime": 322
}