@sun-asterisk/sunlint
Version:
☀️ SunLint - Multi-language static analysis tool for code quality and security | Sun* Engineering Standards
65 lines (64 loc) • 1.38 kB
JSON
{
"id": "C010_limit_block_nesting",
"name": "C010_limit_block_nesting",
"category": "complexity",
"description": "C010 - Limit nested blocks (if/for/while/switch/try) to maximum 3 levels for readability",
"severity": "warning",
"enabled": true,
"semantic": {
"enabled": true,
"priority": "high",
"fallback": "heuristic"
},
"patterns": {
"include": [
"**/*.js",
"**/*.ts",
"**/*.jsx",
"**/*.tsx"
],
"exclude": [
"**/*.test.js",
"**/*.test.ts",
"**/*.spec.js",
"**/*.spec.ts",
"**/node_modules/**",
"**/dist/**",
"**/build/**"
]
},
"analysis": {
"approach": "symbol-based-primary",
"fallback": "regex-based",
"depth": 3,
"timeout": 5000
},
"nesting": {
"maxDepth": 3,
"countingStatements": [
"IfStatement",
"ForStatement",
"ForInStatement",
"ForOfStatement",
"WhileStatement",
"DoStatement",
"SwitchStatement",
"TryStatement",
"CatchClause"
],
"ignoredStatements": [
"FunctionDeclaration",
"MethodDeclaration",
"ArrowFunction",
"FunctionExpression",
"Constructor",
"ClassDeclaration",
"InterfaceDeclaration"
]
},
"options": {
"ignoreComments": true,
"countEmptyBlocks": false,
"treatCatchAsBlock": true
}
}