Doctor · health

DOC0010Review file-level branch complexity

A source file has a cyclomatic complexity score of at least 15.
vite-doctor/corehealthwarnNo fix
workspace/health/high-cyclomatic-complexitysrc/core/internal/workspace-graph.ts

Why it happens

Doctor starts the file score at one and counts branch syntax such as conditionals, loops, logical expressions, switch cases, and catch clauses. The threshold applies to the whole file, not an individual function. It is a maintenance heuristic, not a runtime performance measurement.

Fix

Inspect the branches and their tests. Split independent responsibilities into smaller modules or simplify unnecessary branching while preserving behavior. Retain complex logic when it is justified, with focused tests and a scoped suppression if needed.

Verify the fix

Rerun the workspace analysis after editing:

pnpm vite-doctor . --analyses health
  • workspace/health/high-cyclomatic-complexity
Copyright © 2026