Find null-assertion polish opportunities

Proprietary

!! operators (including as arguments), requireNotNull / checkNotNull calls without a lazy message, and throw SomeException() without a contextual message inside an elvis.

org.openrewrite.kotlin.idiom.FindNullAssertionPolish$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.idiom.FindNullAssertionPolish$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 !! non-null assertions
  2. Find !! passed as a function argument
  3. Find requireNotNull(x) without an explanatory message
  4. Find checkNotNull(x) without an explanatory message
  5. Find x ?: throw SomeException() without a message