Inspectopedia Help

If statement with too many branches

Reports if statements with too many branches. Such statements may be confusing, and are often the sign of inadequate levels of design abstraction.


if (a) { print "foo" } else if (b) { print "bar" } else if (c) { print "baz" } else if (d) { print "Too many branches" }

Locating this inspection


Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Groovy | Control flow issues

Use the Maximum number of branches field to specify the maximum number of branches expected.

Inspection options

Here you can find the description of settings available for the If statement with too many branches inspection, and the reference of their default values.

Maximum number of branches



By default bundled with

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin

Groovy, 241.18072

Last modified: 18 June 2024