This documentation explains the 'complexity' rule within the Oxlint linter, which manages cyclomatic complexity to improve code readability. It details how to configure complexity limits and provides examples of both compliant and non-compliant code.
Highlights
Enforces a maximum cyclomatic complexity to prevent code from becoming too difficult to follow.
Offers two calculation variants: 'classic' (McCabe) and 'modified' (where switch statements count as a single unit of complexity).
Provides flexible configuration options including a 'max' threshold and complexity variants.
Supports implementation through JSON configuration, TypeScript configuration, or direct CLI usage.