Why this matters
Improves readability and error propagation.
Break deep map/flatMap chains into named suspend functions or use runCatching/Result for clearer composition.
Improves readability and error propagation.
Side-by-side examples engineers can pattern-match during review.
a()?.flatMap { b(it) }?.flatMap { c(it) }?.map { d(it) }suspend fun step1() = a()
suspend fun step2(x: X) = b(x)
val out = step1()?.let { step2(it) }aaa.flatMap{...}.flatMap{...}.map{...}extract steps into named functionsFrom the same buckets as this rule.
Check if loops use equality operators (== or !=) in termination conditions. These can lead to infinite loops if the condition is never met exactly. Instead, use relational operators like < or > for safer loop termination.