Find runCatching { } smells
ProprietarySearch-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$KtRecipemod 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.
- Find
runCatching { }blocks that may swallowCancellationException - Find
runCatching { }.getOrNull()chains - Find
runCatching { }calls whose result is discarded - Find
runCatching { }.onFailure { log… }chains with no further handling - Find
runCatching { }.onSuccess { … }chains with no failure handler - Find
.getOrThrow()calls on aResult<T>