CleanLens rules
the short rule table that ships inside the extension package.
14 rules, configured in .clean-code-tracker.json. Every rule has enabled and severity (low | medium | high | critical); some also take limit or options.
| Rule id | Reported when | Default limit | JS/TS | Python |
|---|---|---|---|---|
maxFunctionLines | a function is longer than the limit | 40 lines | ✅ | ✅ |
maxFileLines | a file is longer than the limit | 400 lines | ✅ | ✅ |
maxParameters | a function takes more parameters than the limit | 5 | ✅ | ✅ |
maxComplexity | cyclomatic complexity exceeds the limit | 10 | ✅ | ✅ (approx.) |
maxNestingDepth | control-flow nesting is deeper than the limit | 4 | ✅ | ✅ (by indentation) |
detectDuplicateCode | an identical block repeats across files | options.minLines = 6 | ✅ | ✅ |
detectUnusedCode | an import / variable / function is never used | — | ✅ | ✅ (imports only) |
requireClearVariableNames | a vague name such as data1 or x | — | ✅ | ✅ |
requireErrorHandling | a failure-prone operation with no try | — | ✅ (await) | ✅ (open / requests / …) |
forbidEmptyCatchBlocks | an empty catch / except | — | ✅ | ✅ (pass) |
forbidHardcodedSecrets | an API key or password in the code | — | ✅ | ✅ |
forbidDebugStatements | console.log / debugger / print / breakpoint | — | ✅ | ✅ |
requireSingleResponsibility | a class with many methods, or a function that is both long and complex | options.maxMethods = 10 | ✅ | ✅ |
requireDocumentationForComplexCode | function complexity ≥ threshold with no JSDoc / docstring | options.complexityThreshold = 15 | ✅ | ✅ |
Notes on accuracy
requireErrorHandling,requireSingleResponsibility,requireDocumentationForComplexCodeare approximate by nature and can produce false positives. Disable them or raise their limits if they are noisy for your team.- The Python analyzer is indentation- and pattern-based (no full AST). For more accurate analysis later, Ruff/Pylint can be integrated as in the plan.
detectUnusedCodefor JS/TS has no type information — it only catches obvious cases (a name that appears exactly once).