Find let { } ergonomics

Proprietary

?.let { it }, ?.let { it.foo() } (including property reads), nested let ladders, let blocks at statement position, and the ?.let { } ?: y pattern — all cases where let { } adds shape without clarity.

org.openrewrite.kotlin.idiom.FindLetIdioms$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.idiom.FindLetIdioms$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 ?.let { it } no-ops
  2. Find ?.let { it.foo() } that could use ?.foo()
  3. Find obj.let { fn(it) } where obj is non-null
  4. Find x?.let { } ?: y patterns
  5. Find nested let { } chains
  6. Find ?.let { } calls at statement position