Skip to main content

Find OpenRewrite recipes

org.openrewrite.java.recipes.FindRecipes

This recipe finds all OpenRewrite recipes, primarily to produce a data table that is being used to experiment with fine-tuning a large language model to produce more recipes.

Recipe source

GitHub, Issue Tracker, Maven Central

This recipe is available under the Moderne Source Available License.

Example

Before
import org.openrewrite.Option;
import org.openrewrite.internal.lang.NonNullApi;
import org.openrewrite.Recipe;
import org.openrewrite.internal.lang.Nullable;

@NonNullApi
class MyRecipe extends Recipe {
@Option(displayName = "Method pattern",
description = "A method pattern that is used to find matching method declarations/invocations.",
example = "org.mockito.Matchers anyVararg()")
String methodPattern;

@Option(displayName = "New access level",
description = "New method access level to apply to the method, like \"public\".",
example = "public",
valid = {"private", "protected", "package", "public"},
required = false)
String newAccessLevel;

@Override
public String getDisplayName() {
return "My recipe";
}

@Override
public String getDescription() {
return "This is my recipe.";
}
}
After
import org.openrewrite.Option;
import org.openrewrite.internal.lang.NonNullApi;
import org.openrewrite.Recipe;
import org.openrewrite.internal.lang.Nullable;

@NonNullApi
class /*~~>*/MyRecipe extends Recipe {
@Option(displayName = "Method pattern",
description = "A method pattern that is used to find matching method declarations/invocations.",
example = "org.mockito.Matchers anyVararg()")
String methodPattern;

@Option(displayName = "New access level",
description = "New method access level to apply to the method, like \"public\".",
example = "public",
valid = {"private", "protected", "package", "public"},
required = false)
String newAccessLevel;

@Override
public String getDisplayName() {
return "My recipe";
}

@Override
public String getDescription() {
return "This is my recipe.";
}
}

Usage

This recipe has no required configuration options. It can be activated by adding a dependency on org.openrewrite.recipe:rewrite-rewrite in your build file or by running a shell command (in which case no build changes are needed):

  1. Add the following to your build.gradle file:
build.gradle
plugins {
id("org.openrewrite.rewrite") version("7.6.2")
}

rewrite {
activeRecipe("org.openrewrite.java.recipes.FindRecipes")
setExportDatatables(true)
}

repositories {
mavenCentral()
}

dependencies {
rewrite("org.openrewrite.recipe:rewrite-rewrite:0.6.0")
}
  1. Run gradle rewriteRun to run the recipe.

See how this recipe works across multiple open-source repositories

Run this recipe on OSS repos at scale with the Moderne SaaS.

The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories.

Please contact Moderne for more information about safely running the recipes on your own codebase in a private SaaS.

Data Tables

Rewrite recipe source code

org.openrewrite.table.RewriteRecipeSource

This table contains the source code of recipes along with their metadata for use in an experiment fine-tuning large language models to produce more recipes.

Column NameDescription
Recipe nameThe name of the recipe.
Recipe descriptionThe description of the recipe.
Recipe typeDifferentiate between Java and YAML recipes, as they may be two independent data sets used in LLM fine-tuning.
Recipe source codeThe full source code of the recipe.
Recipe optionsJSON format of recipe options.

Contributors

JohannisK