Find cast and nullable-shape idioms

Proprietary

Unsafe as casts vs as?, takeIf { }?.let { } chains, takeUnless { !p } double-negatives, deep ?. safe-call chains, explicit return null statements.

org.openrewrite.kotlin.idiom.FindCastAndNullableShapes$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.idiom.FindCastAndNullableShapes$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 unsafe as casts
  2. Find x.takeIf { p }?.let { ... } patterns
  3. Find takeUnless { !p } (double-negative) patterns
  4. Find long ?. safe-call chains
  5. Find return null in functions with nullable returns