Find best-practice candidates
Recipe ID
org.openrewrite.kotlin.bestpractices.FindBestPracticeCandidates$KtRecipeArtifact
io.moderne.recipe:recipes-kotlinSearch-only bundle: flags places where a more idiomatic Kotlin spelling is available. Each match shows up as a SearchResult for review; nothing is rewritten automatically because the migration is a judgment call.
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.bestpractices.FindBestPracticeCandidates$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 class-declaration smells
org.openrewrite.kotlin.bestpractices.FindClassStructureSmells$KtRecipe - Find function-declaration smells
org.openrewrite.kotlin.bestpractices.FindFunctionDeclarationSmells$KtRecipe - Find string-construction smells
org.openrewrite.kotlin.bestpractices.FindStringConstructionSmells$KtRecipe - Find Boolean-conditional smells
org.openrewrite.kotlin.bestpractices.FindBooleanConditionalSmells$KtRecipe - Find lambda / functional smells
org.openrewrite.kotlin.bestpractices.FindLambdaSmells$KtRecipe - Find exception-handling smells
org.openrewrite.kotlin.bestpractices.FindExceptionHandlingSmells$KtRecipe - Find scope-function smells
org.openrewrite.kotlin.bestpractices.FindScopeFunctionSmells$KtRecipe - Find
when-statement smellsorg.openrewrite.kotlin.bestpractices.FindWhenSmells$KtRecipe - Find equality / comparison smells
org.openrewrite.kotlin.bestpractices.FindEqualitySmells$KtRecipe - Find
lazy { }calls without an explicitLazyThreadSafetyModeorg.openrewrite.kotlin.bestpractices.FindLazyWithoutMode$KtRecipe - Find wildcard
import a.b.*statementsorg.openrewrite.kotlin.bestpractices.FindWildcardImport$KtRecipe - Find anonymous
object : Interface { override fun … }with a single overrideorg.openrewrite.kotlin.bestpractices.FindAnonymousObjectSingleMethod$KtRecipe - Find chained
!!assertions in a single expressionorg.openrewrite.kotlin.bestpractices.FindDoubleBangChain$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