max_switch_cases

SeverityQuick FixOptions
Warning

Details

DO limit the number of cases in a switch statement or switch expression.

Usage

To enable the max_switch_cases rule, add max_switch_cases under rules in your analysis_options.yaml file:

custom_lint:
  rules:
    - max_switch_cases

Options

OptionTypeDescriptionDefault Value
max_casesintThe maximum number of cases.10

To configure the maximum number of cases, add an int to the max_cases option:

custom_lint:
  rules:
    - max_switch_cases:
      max_cases: 5