Find hotspots and complexity points
Recipe ID
org.openrewrite.kotlin.search.FindHotspots$KtRecipeArtifact
io.moderne.recipe:recipes-kotlinSurface large classes, long functions, wide parameter lists, sprawling when expressions, deep nesting, god classes, magic numbers, and unmarked self-recursion. Each match is a candidate for a reviewer (or LLM agent) to refactor or to read carefully when building a mental model of the file.
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.kotlin.search.FindHotspots$KtRecipeIf the recipe isn’t available locally, install it with:
mod config recipes jar install io.moderne.recipe:recipes-kotlin:0.2.0Definition
This recipe runs the following recipes in order.
- Find classes with more than 200 statements
org.openrewrite.kotlin.search.FindLargeClasses$KtRecipe - Find functions with more than 30 statements
org.openrewrite.kotlin.search.FindLongFunctions$KtRecipe - Find functions with more than 5 parameters
org.openrewrite.kotlin.search.FindManyParameters$KtRecipe - Find
whenexpressions with more than 10 branchesorg.openrewrite.kotlin.search.FindLargeWhenBranches$KtRecipe - Find functions with nesting depth greater than 4
org.openrewrite.kotlin.search.FindDeepNesting$KtRecipe - Find classes with more than 25 methods
org.openrewrite.kotlin.search.FindGodClasses$KtRecipe - Find numeric literals other than 0, 1, -1
org.openrewrite.kotlin.search.FindMagicNumbers$KtRecipe - Find recursive functions not marked
tailrecorg.openrewrite.kotlin.search.FindRecursionWithoutTailrec$KtRecipe - Find functions with empty bodies
org.openrewrite.kotlin.search.FindEmptyFunctions$KtRecipe - Find
!!not-null assertionsorg.openrewrite.kotlin.search.FindNotNullAssertions$KtRecipe
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats