CleanLens rules

the short rule table that ships inside the extension package.

2 min read1 sections

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 idReported whenDefault limitJS/TSPython
maxFunctionLinesa function is longer than the limit40 lines✅✅
maxFileLinesa file is longer than the limit400 lines✅✅
maxParametersa function takes more parameters than the limit5✅✅
maxComplexitycyclomatic complexity exceeds the limit10✅✅ (approx.)
maxNestingDepthcontrol-flow nesting is deeper than the limit4✅✅ (by indentation)
detectDuplicateCodean identical block repeats across filesoptions.minLines = 6✅✅
detectUnusedCodean import / variable / function is never used—✅✅ (imports only)
requireClearVariableNamesa vague name such as data1 or x—✅✅
requireErrorHandlinga failure-prone operation with no try—✅ (await)✅ (open / requests / …)
forbidEmptyCatchBlocksan empty catch / except—✅✅ (pass)
forbidHardcodedSecretsan API key or password in the code—✅✅
forbidDebugStatementsconsole.log / debugger / print / breakpoint—✅✅
requireSingleResponsibilitya class with many methods, or a function that is both long and complexoptions.maxMethods = 10✅✅
requireDocumentationForComplexCodefunction complexity ≥ threshold with no JSDoc / docstringoptions.complexityThreshold = 15✅✅

Notes on accuracy

  • requireErrorHandling, requireSingleResponsibility, requireDocumentationForComplexCode are 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.
  • detectUnusedCode for JS/TS has no type information — it only catches obvious cases (a name that appears exactly once).