prefer-correct-switch-length
Warns when a switch has too few or too many cases.
⚙️ Config
Set min-length
(default is 3
) to configure the minimum number of cases.
Set max-length
(default is 10
) to configure the maximum number of cases after which the rule should trigger.
Set ignore-fallthrough-cases
(default is false
) to ignore fallthrough cases (with no body) (example).
analysis_options.yaml
dart_code_metrics:
rules:
- prefer-correct-switch-length:
min-length: 3
max-length: 10
ignore-fallthrough-cases: false