Find Result<T> API ergonomics opportunities

Proprietary

Search-only bundle for Result<T> call sites where a different operator would be clearer: if (result.isSuccess) … else … (use .fold(...)), Result.map { … }.getOrThrow() (drop the Result wrapper or use .fold(...)), and getOrElse { default } whose lambda ignores the failure (use getOrDefault(default)).

org.openrewrite.kotlin.functional.FindResultErgonomics$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.functional.FindResultErgonomics$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 if (result.isSuccess) … else … patterns
  2. Find Result.map { }.getOrThrow() chains
  3. Find Result.getOrElse { } whose lambda ignores the failure parameter