Skip to content

VBC-065: hadouken-nested-logic

warning

Category: clean-code
Analysis: AST
Tags: clean-code

What it reports

Nested logic is {count} levels deep at line {line}, over the limit of {threshold}. Return early, extract the inner block, or invert a condition.

Flagged

ts
function deep(a) {
  if (a) {
    for (;;) {
      while (a) {
        if (a) {
          switch (a) { default: break; }
        }
      }
    }
  }
}

Not flagged

ts
function shallow(a) {
  if (a) { return 1; }
  return 0;
}

AST check

  • Type: nested-blocks-limit
  • Threshold: 4

Released under the MIT License.