Functional
Composite Recipes
Recipes that include further recipes, often including the individual recipes below.
- Find
Result<T>API ergonomics opportunities - Find nullability idiom opportunities
- Find raw
try/catchsmells - Find
runCatching \{ \}smells - Find throw/catch shape smells
- Modernize Kotlin functional /
Resultergonomics
Recipes
- Find
.getOrThrow()calls on aResult<T> - Find
Result.getOrElse \{ \}whose lambda ignores the failure parameter - Find
Result.map \{ \}.getOrThrow()chains - Find broad
catch (e: Exception)/catch (e: Throwable)clauses - Find
catch (e: Exception)clauses whose body never referencese - Find
catch (e: Exception) \{ throw OtherException(...) \}withouteas cause - Find
catch (e: Exception) \{ throw e \}patterns - Find
e.printStackTrace()calls inside a catch block - Find empty catch blocks
- Find
if (predicate(x)) x else nullpatterns - Find
if (result.isSuccess) … else …patterns - Find
if (x != null) f(x) else nullpatterns - Find
if (x != null) x else defaultpatterns - Find
if (x == null) throw IllegalArgumentException(...)patterns - Find
if (x == null) throw IllegalStateException(...)patterns - Find non-empty catch blocks that neither log nor rethrow
- Find
runCatching \{ \}blocks that may swallowCancellationException - Find
runCatching \{ \}calls whose result is discarded - Find
runCatching \{ \}.getOrNull()chains - Find
runCatching \{ \}.onFailure \{ log… \}chains with no further handling - Find
runCatching \{ \}.onSuccess \{ … \}chains with no failure handler - Find
throw RuntimeException(e)inside a catch block - Find
try \{ x \} catch (e: Exception) \{ default \}patterns - Find
try \{ x \} catch (e: Exception) \{ null \}patterns - Find
try \{ \} catch \{ \}nested inside anothertry \{ \} catch \{ \}