agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
69 lines (59 loc) • 1.97 kB
JavaScript
/**
* @file Complexity analysis command-line parser
* @description Handles parsing of command-line arguments for complexity analysis
*/
function parseComplexityArgs(args) {
const options = {
mode: 'auto',
outputFormat: 'summary',
threshold: 'medium',
includeDebt: false
};
let targetPath = '.';
for (let i = 0; i < args.length; i++) {
switch (args[i]) {
case '--mode':
options.mode = args[++i];
break;
case '--output-format':
options.outputFormat = args[++i];
break;
case '--threshold':
options.threshold = args[++i];
break;
case '--include-debt':
options.includeDebt = true;
break;
default:
if (!args[i].startsWith('--')) {
targetPath = args[i];
}
}
}
return { options, targetPath };
}
function showComplexityUsage() {
console.log(`
Usage: node analyze-complexity.js [OPTIONS] <file-or-directory>
Analyzes code complexity and technical debt to identify maintainability issues.
OPTIONS:
--mode <mode> Analysis mode: file, project (default: auto-detect)
--output-format <fmt> Output format: json, summary, detailed (default: summary)
--threshold <level> Complexity threshold: low, medium, high (default: medium)
--include-debt Include technical debt analysis (default: false)
--help Show this help message
EXAMPLES:
node analyze-complexity.js src/components/UserProfile.js
node analyze-complexity.js --mode project --include-debt .
node analyze-complexity.js --output-format json --threshold high src/
OUTPUT:
The tool outputs complexity analysis results in the specified format.
- summary: Human-readable summary of complexity metrics and issues
- detailed: Detailed analysis with specific recommendations
- json: Machine-readable JSON output for AI agent consumption
`);
}
module.exports = {
parseComplexityArgs,
showComplexityUsage
};