Given a switch statement with enough cases, applying the redundantReturn rule will throw a "Failed to terminate" error. Only guessing here, but I'd imagine other rules that process each case of a switch statement may have this limitation as well.
The limit currently seems to be 18 cases before you get a "Failed to terminate" error. Processing the switch statement below will throw the error, but removing any one of those cases will avoid it.
The problem also goes away if the default value for maxIterations is increased to 11. The more cases, the more you maxIterations needs to be increased.
func test(_ value: SomeEnum) -> String {
switch value {
case .one:
return ""
case .two:
return ""
case .three:
return ""
case .four:
return ""
case .five:
return ""
case .six:
return ""
case .seven:
return ""
case .eight:
return ""
case .nine:
return ""
case .ten:
return ""
case .eleven:
return ""
case .twelve:
return ""
case .thirteen:
return ""
case .fourteen:
return ""
case .fifteen:
return ""
case .sixteen:
return ""
case .seventeen:
return ""
case .eighteen:
return ""
case .nineteen:
return ""
}
}
Given a switch statement with enough cases, applying the
redundantReturn
rule will throw a "Failed to terminate" error. Only guessing here, but I'd imagine other rules that process each case of a switch statement may have this limitation as well.The limit currently seems to be 18 cases before you get a "Failed to terminate" error. Processing the switch statement below will throw the error, but removing any one of those cases will avoid it.
The problem also goes away if the default value for
maxIterations
is increased to 11. The more cases, the more youmaxIterations
needs to be increased.