Find Result.map { }.getOrThrow() chains

Proprietary

result.map { transform(it) }.getOrThrow() is result.fold(::transform, { throw it }) written long-hand — and .fold(...) keeps the transformation and the failure handling next to each other. If the failure branch really is 'rethrow', drop the Result wrapper entirely and put the transformation inside runCatching { }.

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