Find iteration-shape smells

Proprietary

Flags iteration idioms that have a clearer, allocation-equivalent Kotlin form — currently the for (i in xs.indices) { val x = xs[i] } shape that forEachIndexed { i, x -> } replaces.

org.openrewrite.kotlin.performance.FindIterationSmells$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.performance.FindIterationSmells$KtRecipe'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Find for (i in xs.indices) { val x = xs[i] } patterns