Find runCatching { } smells

Proprietary

Search-only bundle covering the most common runCatching { } pitfalls: swallowing CancellationException, collapsing failures into null via .getOrNull(), discarding the Result in statement context, log-only handlers that drop the failure on the floor, .onSuccess { } chains with no failure handler, and .getOrThrow() patterns that turn the Result round-trip into pure ceremony.

org.openrewrite.kotlin.functional.FindRunCatchingSmells$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.functional.FindRunCatchingSmells$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 runCatching { } blocks that may swallow CancellationException
  2. Find runCatching { }.getOrNull() chains
  3. Find runCatching { } calls whose result is discarded
  4. Find runCatching { }.onFailure { log… } chains with no further handling
  5. Find runCatching { }.onSuccess { … } chains with no failure handler
  6. Find .getOrThrow() calls on a Result<T>