From 96d6f0fa1600db5554b8262c5f206de12e4c9fff Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 26 Feb 2024 00:04:25 +0100 Subject: [PATCH] Add links to docs & reference implementations in README.md --- .java-version | 1 - README.md | 24 +++++++++++++++++-- .../{stringuitls.yml => stringutils.yml} | 4 ++-- 3 files changed, 24 insertions(+), 5 deletions(-) delete mode 100644 .java-version rename src/main/resources/META-INF/rewrite/{stringuitls.yml => stringutils.yml} (91%) diff --git a/.java-version b/.java-version deleted file mode 100644 index b4de394..0000000 --- a/.java-version +++ /dev/null @@ -1 +0,0 @@ -11 diff --git a/README.md b/README.md index 193a76e..69433d2 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,31 @@ To begin, fork this repository and customize it by: 2. Changing the `group` in `build.gradle.kts`. 3. Changing the package structure from `com.yourorg` to whatever you want. -## Detailed Guide +## Getting started -There is a [comprehensive getting started guide](https://docs.openrewrite.org/authoring-recipes/recipe-development-environment) +Familiarize yourself with the [OpenRewrite documentation](https://docs.openrewrite.org/), in particular the [concepts & explanations](https://docs.openrewrite.org/concepts-explanations) op topics like the [lossless semantic trees](https://docs.openrewrite.org/concepts-explanations/lossless-semantic-trees), [recipes](https://docs.openrewrite.org/concepts-explanations/recipes) and [visitors](https://docs.openrewrite.org/concepts-explanations/visitors). + +You might be interested to watch some of the [videos available on OpenRewrite and Moderne](https://www.youtube.com/@moderne-auto-remediation). + +Once you want to dive into the code there is a [comprehensive getting started guide](https://docs.openrewrite.org/authoring-recipes/recipe-development-environment) available in the OpenRewrite docs that provides more details than the below README. +## Reference recipes + +* [META-INF/rewrite/stringutils.yml](./src/main/resources/META-INF/rewrite/stringutils.yml) - A declarative YAML recipe that replaces usages of `org.springframework.util.StringUtils` with `org.apache.commons.lang3.StringUtils`. +* [NoGuavaListsNewArrayList.java](./src/main/java/com/yourorg/NoGuavaListsNewArrayList.java) - An imperative Java recipe that replaces usages of `com.google.common.collect.Lists` with `new ArrayList<>()`. + - [NoGuavaListsNewArrayListTest.java](./src/test/java/com/yourorg/NoGuavaListsNewArrayListTest.java) - A test class for the `NoGuavaListsNewArrayList` recipe. +* [SimplifyTernary](./src/main/java/com/yourorg/SimplifyTernary.java) - An Refaster style recipe that simplifies ternary expressions. + - [SimplifyTernaryTest](./src/test/java/com/yourorg/SimplifyTernaryTest.java) - A test class for the `SimplifyTernary` recipe. +* [AssertEqualsToAssertThat](./src/main/java/com/yourorg/AssertEqualsToAssertThat.java) - An imperative Java recipe that replaces JUnit's `assertEquals` with AssertJ's `assertThat`, to show how to handle classpath dependencies. + - [AssertEqualsToAssertThatTest](./src/test/java/com/yourorg/AssertEqualsToAssertThatTest.java) - A test class for the `AssertEqualsToAssertThat` recipe. +* [AppendToReleaseNotes](./src/main/java/com/yourorg/AppendToReleaseNotes.java) - A ScanningRecipe that appends a message to the release notes of a project. + - [AppendToReleaseNotesTest](./src/test/java/com/yourorg/AppendToReleaseNotesTest.java) - A test class for the `AppendToReleaseNotes` recipe. +* [ClassHierarchy](./src/main/java/com/yourorg/ClassHierarchy.java) - A recipe that demonstrates how to produce a data table on the class hierarchy of a project. + - [ClassHierarchyTest](./src/test/java/com/yourorg/ClassHierarchyTest.java) - A test class for the `ClassHierarchy` recipe. +* [UpdateConcoursePipeline](./src/main/java/com/yourorg/UpdateConcoursePipeline.java) - A recipe that demonstrates how to update a Concourse pipeline, as an example of operating on Yaml files. + - [UpdateConcoursePipelineTest](./src/test/java/com/yourorg/UpdateConcoursePipelineTest.java) - A test class for the `UpdateConcoursePipeline` recipe. + ## Local Publishing for Testing Before you publish your recipe module to an artifact repository, you may want to try it out locally. diff --git a/src/main/resources/META-INF/rewrite/stringuitls.yml b/src/main/resources/META-INF/rewrite/stringutils.yml similarity index 91% rename from src/main/resources/META-INF/rewrite/stringuitls.yml rename to src/main/resources/META-INF/rewrite/stringutils.yml index 6eec98a..cf507c3 100644 --- a/src/main/resources/META-INF/rewrite/stringuitls.yml +++ b/src/main/resources/META-INF/rewrite/stringutils.yml @@ -17,8 +17,8 @@ --- type: specs.openrewrite.org/v1beta/recipe name: com.example.UseApacheStringUtils -displayName: Use apache string utils -description: Replace Spring string utilities with apache string utilities +displayName: Use Apache `StringUtils` +description: Replace Spring string utilities with Apache string utilities recipeList: - org.openrewrite.java.dependencies.AddDependency: groupId: org.apache.commons