Back to Intellij Community

GroovyIfStatementWithTooManyBranches

plugins/groovy/groovy-psi/resources/inspectionDescriptions/GroovyIfStatementWithTooManyBranches.html

2025.3-rc-2398 B
Original Source

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

Example:

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

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