agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
1,418 lines • 64.6 kB
JSON
{
"timestamp": "2025-07-31T06:48:16.351Z",
"summary": {
"totalFiles": 100,
"filesAnalyzed": 100,
"filesWithIssues": 18,
"totalIssues": 34,
"totalEffort": 80,
"performanceScore": 83,
"projectScore": 83,
"projectGrade": "B",
"performanceGrade": "B",
"categoryBreakdown": {
"CPU": 3,
"Algorithm": 14,
"I/O": 13,
"Memory": 1,
"Concurrency": 3
},
"severityBreakdown": {
"HIGH": 28,
"MEDIUM": 6,
"LOW": 0
}
},
"files": [
{
"file": "../config/localVars.js",
"issues": [
{
"type": "inefficient_regex",
"severity": "MEDIUM",
"category": "CPU",
"location": "../config/localVars.js:113",
"line": 113,
"code": "pattern: /(query.*=.*SELECT.*\\+|SELECT.*FROM.*WHERE.*=.*\\+)/i,",
"issue": "multiple .+ patterns",
"description": "Inefficient regex: multiple .+ patterns",
"summary": "Inefficient regex: multiple .+ patterns",
"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": "../cli/analyze-cleanup.js",
"issues": [
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-cleanup.js:228-240",
"line": 240,
"outerLoop": 228,
"innerLoop": 240,
"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-performance.js",
"issues": [
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-performance.js:163-164",
"line": 164,
"outerLoop": 163,
"innerLoop": 164,
"code": "for (const issue of file.issues) {",
"description": "Nested iteration creating O(n²) complexity: for (const file of results.files) {... → for (const issue of file.issues) {...",
"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-scalability.js",
"issues": [
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-scalability.js:128-129",
"line": 129,
"outerLoop": 128,
"innerLoop": 129,
"code": "for (const issue of file.issues) {",
"description": "Nested iteration creating O(n²) complexity: for (const file of results.files) {... → for (const issue of file.issues) {...",
"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-161",
"line": 161,
"outerLoop": 150,
"innerLoop": 161,
"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:159-161",
"line": 161,
"outerLoop": 159,
"innerLoop": 161,
"code": "fileAnalysis.vulnerabilities = fileAnalysis.vulnerabilities.filter(vuln => {",
"description": "Nested iteration creating O(n²) complexity: for (let i = 0; i < results.projectAnaly... → 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:174-185",
"line": 185,
"outerLoop": 174,
"innerLoop": 185,
"code": "for (let i = 1; i < topVulns.length; i++) {",
"description": "Nested iteration creating O(n²) complexity: for (const vuln of file.vulnerabilities)... → for (let i = 1; i < topVulns.length; i++...",
"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:314-324",
"line": 324,
"outerLoop": 314,
"innerLoop": 324,
"code": "analysis.topVulnerabilities.slice(0, 5).forEach((vuln, index) => {",
"description": "Nested iteration creating O(n²) complexity: Object.keys(analysis.categoryBreakdown).... → analysis.topVulnerabilities.slice(0, 5)....",
"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:373-390",
"line": 390,
"outerLoop": 373,
"innerLoop": 390,
"code": "criticalVulns.slice(0, 3).forEach(vuln => {",
"description": "Nested iteration creating O(n²) complexity: Object.keys(severityCount).forEach(sever... → criticalVulns.slice(0, 3).forEach(vuln =...",
"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:380-390",
"line": 390,
"outerLoop": 380,
"innerLoop": 390,
"code": "criticalVulns.slice(0, 3).forEach(vuln => {",
"description": "Nested iteration creating O(n²) complexity: analysis.vulnerabilities.forEach(v => {... → criticalVulns.slice(0, 3).forEach(vuln =...",
"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": 97,
"metrics": {
"totalIssues": 6,
"score": 97,
"grade": "A",
"totalEffort": 18,
"categoryBreakdown": {
"Algorithm": 6
},
"severityBreakdown": {
"HIGH": 6,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 6,
"score": 97,
"grade": "A",
"totalEffort": 18,
"categoryBreakdown": {
"Algorithm": 6
},
"severityBreakdown": {
"HIGH": 6,
"MEDIUM": 0,
"LOW": 0
}
}
},
{
"file": "../cli/analyze-srp.js",
"issues": [
{
"type": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../cli/analyze-srp.js:283",
"line": 283,
"code": "if (!fs.existsSync(targetPath)) {",
"operation": "existsSync",
"pattern": "fs.existsSync",
"description": "Synchronous existsSync blocks event loop",
"summary": "Synchronous existsSync blocks event loop",
"recommendation": "Replace with async equivalent (exists with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
},
{
"type": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../cli/analyze-srp.js:289",
"line": 289,
"code": "const isFile = fs.statSync(targetPath).isFile();",
"operation": "statSync",
"pattern": "fs.statSync",
"description": "Synchronous statSync blocks event loop",
"summary": "Synchronous statSync blocks event loop",
"recommendation": "Replace with async equivalent (stat with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
}
],
"performanceScore": 99,
"metrics": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 4,
"categoryBreakdown": {
"I/O": 2
},
"severityBreakdown": {
"HIGH": 2,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 4,
"categoryBreakdown": {
"I/O": 2
},
"severityBreakdown": {
"HIGH": 2,
"MEDIUM": 0,
"LOW": 0
}
}
},
{
"file": "../cli/analyze-ui-problems.js",
"issues": [
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-ui-problems.js:145-146",
"line": 146,
"outerLoop": 145,
"innerLoop": 146,
"code": "for (const issue of file.issues) {",
"description": "Nested iteration creating O(n²) complexity: for (const file of results.files) {... → for (const issue of file.issues) {...",
"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": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../cli/analyze-ui-problems.js:342",
"line": 342,
"code": "const stat = fs.statSync(targetPath);",
"operation": "statSync",
"pattern": "fs.statSync",
"description": "Synchronous statSync blocks event loop",
"summary": "Synchronous statSync blocks event loop",
"recommendation": "Replace with async equivalent (stat with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
}
],
"performanceScore": 99,
"metrics": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 5,
"categoryBreakdown": {
"Algorithm": 1,
"I/O": 1
},
"severityBreakdown": {
"HIGH": 2,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 5,
"categoryBreakdown": {
"Algorithm": 1,
"I/O": 1
},
"severityBreakdown": {
"HIGH": 2,
"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:260-270",
"line": 270,
"outerLoop": 260,
"innerLoop": 270,
"code": "const lineStrings = lines.map((line, idx) =>",
"description": "Nested iteration creating O(n²) complexity: group.blocks.forEach((block, j) => {... → const lineStrings = lines.map((line, idx...",
"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": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../cli/analyze-wet-code.js:334",
"line": 334,
"code": "const stat = fs.statSync(targetPath);",
"operation": "statSync",
"pattern": "fs.statSync",
"description": "Synchronous statSync blocks event loop",
"summary": "Synchronous statSync blocks event loop",
"recommendation": "Replace with async equivalent (stat with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
},
{
"type": "unbounded_array",
"severity": "HIGH",
"category": "Memory",
"location": "../cli/analyze-wet-code.js:215",
"line": 215,
"code": "output.push(` 📍 Lines: ${group.blocks.map(b => `${b.startLine}-${b.endLine}`).join(', ')}`);",
"operation": "push",
"description": "Unbounded array push in loop — potential memory leak",
"summary": "Unbounded array push — potential memory leak",
"recommendation": "Add size limits, use circular buffer, or implement cleanup logic",
"effort": 3,
"impact": "prevents memory bloat; unbounded growth fixed",
"estimatedSavings": "prevents memory bloat; unbounded growth fixed"
}
],
"performanceScore": 99,
"metrics": {
"totalIssues": 3,
"score": 99,
"grade": "A",
"totalEffort": 8,
"categoryBreakdown": {
"Algorithm": 1,
"I/O": 1,
"Memory": 1
},
"severityBreakdown": {
"HIGH": 3,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 3,
"score": 99,
"grade": "A",
"totalEffort": 8,
"categoryBreakdown": {
"Algorithm": 1,
"I/O": 1,
"Memory": 1
},
"severityBreakdown": {
"HIGH": 3,
"MEDIUM": 0,
"LOW": 0
}
}
},
{
"file": "../cli/problem-scope.js",
"issues": [
{
"type": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../cli/problem-scope.js:283",
"line": 283,
"code": "const items = fs.readdirSync(dirPath, { withFileTypes: true });",
"operation": "readdirSync",
"pattern": "fs.readdirSync",
"description": "Synchronous readdirSync blocks event loop",
"summary": "Synchronous readdirSync blocks event loop",
"recommendation": "Replace with async equivalent (readdir with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
},
{
"type": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../cli/problem-scope.js:663",
"line": 663,
"code": "fs.writeFileSync(filename, JSON.stringify(reportData, null, 2));",
"operation": "writeFileSync",
"pattern": "fs.writeFileSync",
"description": "Synchronous writeFileSync blocks event loop",
"summary": "Synchronous writeFileSync blocks event loop",
"recommendation": "Replace with async equivalent (writeFile with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
}
],
"performanceScore": 99,
"metrics": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 4,
"categoryBreakdown": {
"I/O": 2
},
"severityBreakdown": {
"HIGH": 2,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 4,
"categoryBreakdown": {
"I/O": 2
},
"severityBreakdown": {
"HIGH": 2,
"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-48",
"line": 48,
"outerLoop": 34,
"innerLoop": 48,
"code": "const allDirectories = new Set(sourceFiles.map(f => path.dirname(f)));",
"description": "Nested iteration creating O(n²) complexity: for (const file of sourceFiles) {... → 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"
}
],
"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/analyzeFrontendBackend.js",
"issues": [
{
"type": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../lib/frontend-backend/analyzeFrontendBackend.js:55",
"line": 55,
"code": "const content = fs.readFileSync(filePath, 'utf8');",
"operation": "readFileSync",
"pattern": "fs.readFileSync",
"description": "Synchronous readFileSync blocks event loop",
"summary": "Synchronous readFileSync blocks event loop",
"recommendation": "Replace with async equivalent (readFile with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
}
],
"performanceScore": 100,
"metrics": {
"totalIssues": 1,
"score": 100,
"grade": "A",
"totalEffort": 2,
"categoryBreakdown": {
"I/O": 1
},
"severityBreakdown": {
"HIGH": 1,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 1,
"score": 100,
"grade": "A",
"totalEffort": 2,
"categoryBreakdown": {
"I/O": 1
},
"severityBreakdown": {
"HIGH": 1,
"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"
},
{
"type": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../lib/frontend-backend/backendEndpointExtractor.js:44",
"line": 44,
"code": "const content = fs.readFileSync(file, 'utf8');",
"operation": "readFileSync",
"pattern": "fs.readFileSync",
"description": "Synchronous readFileSync blocks event loop",
"summary": "Synchronous readFileSync blocks event loop",
"recommendation": "Replace with async equivalent (readFile with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
}
],
"performanceScore": 99,
"metrics": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 5,
"categoryBreakdown": {
"Algorithm": 1,
"I/O": 1
},
"severityBreakdown": {
"HIGH": 2,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 5,
"categoryBreakdown": {
"Algorithm": 1,
"I/O": 1
},
"severityBreakdown": {
"HIGH": 2,
"MEDIUM": 0,
"LOW": 0
}
}
},
{
"file": "../lib/frontend-backend/fileScanner.js",
"issues": [
{
"type": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../lib/frontend-backend/fileScanner.js:19",
"line": 19,
"code": "if (!fs.existsSync(dirPath)) {",
"operation": "existsSync",
"pattern": "fs.existsSync",
"description": "Synchronous existsSync blocks event loop",
"summary": "Synchronous existsSync blocks event loop",
"recommendation": "Replace with async equivalent (exists with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
},
{
"type": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../lib/frontend-backend/fileScanner.js:26",
"line": 26,
"code": "const entries = fs.readdirSync(currentPath, { withFileTypes: true });",
"operation": "readdirSync",
"pattern": "fs.readdirSync",
"description": "Synchronous readdirSync blocks event loop",
"summary": "Synchronous readdirSync blocks event loop",
"recommendation": "Replace with async equivalent (readdir with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
}
],
"performanceScore": 99,
"metrics": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 4,
"categoryBreakdown": {
"I/O": 2
},
"severityBreakdown": {
"HIGH": 2,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 4,
"categoryBreakdown": {
"I/O": 2
},
"severityBreakdown": {
"HIGH": 2,
"MEDIUM": 0,
"LOW": 0
}
}
},
{
"file": "../lib/frontend-backend/frontendBackendProjectAnalyzer.js",
"issues": [
{
"type": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../lib/frontend-backend/frontendBackendProjectAnalyzer.js:32",
"line": 32,
"code": "const content = fs.readFileSync(file, 'utf8');",
"operation": "readFileSync",
"pattern": "fs.readFileSync",
"description": "Synchronous readFileSync blocks event loop",
"summary": "Synchronous readFileSync blocks event loop",
"recommendation": "Replace with async equivalent (readFile with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
},
{
"type": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../lib/frontend-backend/frontendBackendProjectAnalyzer.js:84",
"line": 84,
"code": "const entries = fs.readdirSync(dir, { withFileTypes: true });",
"operation": "readdirSync",
"pattern": "fs.readdirSync",
"description": "Synchronous readdirSync blocks event loop",
"summary": "Synchronous readdirSync blocks event loop",
"recommendation": "Replace with async equivalent (readdir with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
}
],
"performanceScore": 99,
"metrics": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 4,
"categoryBreakdown": {
"I/O": 2
},
"severityBreakdown": {
"HIGH": 2,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 4,
"categoryBreakdown": {
"I/O": 2
},
"severityBreakdown": {
"HIGH": 2,
"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"
},
{
"type": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../lib/frontend-backend/frontendCallExtractor.js:43",
"line": 43,
"code": "const content = fs.readFileSync(file, 'utf8');",
"operation": "readFileSync",
"pattern": "fs.readFileSync",
"description": "Synchronous readFileSync blocks event loop",
"summary": "Synchronous readFileSync blocks event loop",
"recommendation": "Replace with async equivalent (readFile with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
}
],
"performanceScore": 99,
"metrics": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 5,
"categoryBreakdown": {
"Algorithm": 1,
"I/O": 1
},
"severityBreakdown": {
"HIGH": 2,
"MEDIUM": 0,
"LOW": 0
}
},
"summary": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 5,
"categoryBreakdown": {
"Algorithm": 1,
"I/O": 1
},
"severityBreakdown": {
"HIGH": 2,
"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"
},
{
"type": "inefficient_regex",
"severity": "MEDIUM",
"category": "CPU",
"location": "../lib/performance/inefficientRegexDetector.js:55",
"line": 55,
"code": "return line.includes('(?!') && line.split('(?!').length > 2;",
"issue": "nested negative lookaheads",
"description": "Inefficient regex: nested negative lookaheads",
"summary": "Inefficient regex: nested negative lookaheads",
"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": 99,
"metrics": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 4,
"categoryBreakdown": {
"CPU": 2
},
"severityBreakdown": {
"HIGH": 0,
"MEDIUM": 2,
"LOW": 0
}
},
"summary": {
"totalIssues": 2,
"score": 99,
"grade": "A",
"totalEffort": 4,
"categoryBreakdown": {
"CPU": 2
},
"severityBreakdown": {
"HIGH": 0,
"MEDIUM": 2,
"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": "* @file Serial await detector\n* @description 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": "inefficient_regex",
"severity": "MEDIUM",
"category": "CPU",
"location": "../config/localVars.js:113",
"line": 113,
"code": "pattern: /(query.*=.*SELECT.*\\+|SELECT.*FROM.*WHERE.*=.*\\+)/i,",
"issue": "multiple .+ patterns",
"description": "Inefficient regex: multiple .+ patterns",
"summary": "Inefficient regex: multiple .+ patterns",
"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": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-cleanup.js:228-240",
"line": 240,
"outerLoop": 228,
"innerLoop": 240,
"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-performance.js:163-164",
"line": 164,
"outerLoop": 163,
"innerLoop": 164,
"code": "for (const issue of file.issues) {",
"description": "Nested iteration creating O(n²) complexity: for (const file of results.files) {... → for (const issue of file.issues) {...",
"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-scalability.js:128-129",
"line": 129,
"outerLoop": 128,
"innerLoop": 129,
"code": "for (const issue of file.issues) {",
"description": "Nested iteration creating O(n²) complexity: for (const file of results.files) {... → for (const issue of file.issues) {...",
"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-161",
"line": 161,
"outerLoop": 150,
"innerLoop": 161,
"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:159-161",
"line": 161,
"outerLoop": 159,
"innerLoop": 161,
"code": "fileAnalysis.vulnerabilities = fileAnalysis.vulnerabilities.filter(vuln => {",
"description": "Nested iteration creating O(n²) complexity: for (let i = 0; i < results.projectAnaly... → 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:174-185",
"line": 185,
"outerLoop": 174,
"innerLoop": 185,
"code": "for (let i = 1; i < topVulns.length; i++) {",
"description": "Nested iteration creating O(n²) complexity: for (const vuln of file.vulnerabilities)... → for (let i = 1; i < topVulns.length; i++...",
"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:314-324",
"line": 324,
"outerLoop": 314,
"innerLoop": 324,
"code": "analysis.topVulnerabilities.slice(0, 5).forEach((vuln, index) => {",
"description": "Nested iteration creating O(n²) complexity: Object.keys(analysis.categoryBreakdown).... → analysis.topVulnerabilities.slice(0, 5)....",
"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:373-390",
"line": 390,
"outerLoop": 373,
"innerLoop": 390,
"code": "criticalVulns.slice(0, 3).forEach(vuln => {",
"description": "Nested iteration creating O(n²) complexity: Object.keys(severityCount).forEach(sever... → criticalVulns.slice(0, 3).forEach(vuln =...",
"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:380-390",
"line": 390,
"outerLoop": 380,
"innerLoop": 390,
"code": "criticalVulns.slice(0, 3).forEach(vuln => {",
"description": "Nested iteration creating O(n²) complexity: analysis.vulnerabilities.forEach(v => {... → criticalVulns.slice(0, 3).forEach(vuln =...",
"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": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../cli/analyze-srp.js:283",
"line": 283,
"code": "if (!fs.existsSync(targetPath)) {",
"operation": "existsSync",
"pattern": "fs.existsSync",
"description": "Synchronous existsSync blocks event loop",
"summary": "Synchronous existsSync blocks event loop",
"recommendation": "Replace with async equivalent (exists with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
},
{
"type": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../cli/analyze-srp.js:289",
"line": 289,
"code": "const isFile = fs.statSync(targetPath).isFile();",
"operation": "statSync",
"pattern": "fs.statSync",
"description": "Synchronous statSync blocks event loop",
"summary": "Synchronous statSync blocks event loop",
"recommendation": "Replace with async equivalent (stat with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-ui-problems.js:145-146",
"line": 146,
"outerLoop": 145,
"innerLoop": 146,
"code": "for (const issue of file.issues) {",
"description": "Nested iteration creating O(n²) complexity: for (const file of results.files) {... → for (const issue of file.issues) {...",
"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": "sync_io",
"severity": "HIGH",
"category": "I/O",
"location": "../cli/analyze-ui-problems.js:342",
"line": 342,
"code": "const stat = fs.statSync(targetPath);",
"operation": "statSync",
"pattern": "fs.statSync",
"description": "Synchronous statSync blocks event loop",
"summary": "Synchronous statSync blocks event loop",
"recommendation": "Replace with async equivalent (stat with callback/promise)",
"effort": 2,
"impact": "unblocks event loop, 30–60% perf gain under load",
"estimatedSavings": "unblocks event loop, 30-60% perf gain under load"
},
{
"type": "o_n_squared",
"severity": "HIGH",
"category": "Algorithm",
"location": "../cli/analyze-wet-code.js:260-270",
"line": 270,
"outerLoop": 260,
"innerLoop": 270,
"code": "const lineStrings = lines.map((line, idx) =>",
"description": "Nested iteration creating O(n²)