Deep Nesting (ARCH8184)
Key kotlin.quality.deep-nesting · Severity warning · Category quality
Flags control flow nested deeper than three levels.
Incorrect
Section titled “Incorrect”if (a) { if (b) { for (x in xs) { if (x.ok) { doIt() } } } }Correct
Section titled “Correct”if (!a || !b) returnxs.filter { it.ok }.forEach { doIt() }Use early returns, extract functions, or collection operations.