Find if (x == null) throw ... patterns

Proprietary

An if (x == null) throw … is the elvis-throw idiom written long-hand. x ?: throw … keeps the throw expression in line and reads as the assertion it is, rather than as a control-flow branch.

org.openrewrite.kotlin.idiom.FindIfNullThrow$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.idiom.FindIfNullThrow$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.