Skip to content

Commit 0f13e9f

Browse files
timtebeekTeamModerne
authored andcommitted
refactor: OpenRewrite Recipe best practices
Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.recipes.rewrite.OpenRewriteRecipeBestPractices?organizationId=T3BlblJld3JpdGU%3D Co-authored-by: Moderne <[email protected]>
1 parent 6fa03a5 commit 0f13e9f

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

src/main/resources/META-INF/rewrite/examples.yml

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -994,34 +994,31 @@ recipeName: org.openrewrite.java.migrate.UpgradePluginsForJava11
994994
examples:
995995
- description: ''
996996
sources:
997-
- before: project
998-
language: mavenProject
999997
- before: |
1000998
<project>
1001999
<groupId>com.mycompany.app</groupId>
10021000
<artifactId>my-app</artifactId>
10031001
<version>1</version>
1002+
<properties>
1003+
<wro4j.version>1.8.0</wro4j.version>
1004+
</properties>
10041005
<build>
10051006
<plugins>
10061007
<plugin>
1007-
<groupId>org.codehaus.mojo</groupId>
1008-
<artifactId>jaxb2-maven-plugin</artifactId>
1009-
<version>2.3.1</version>
1008+
<groupId>ro.isdc.wro4j</groupId>
1009+
<artifactId>wro4j-maven-plugin</artifactId>
1010+
<version>${wro4j.version}</version>
10101011
</plugin>
10111012
</plugins>
10121013
</build>
10131014
</project>
1014-
path: pom.xml
1015-
language: xml
1016-
- description: ''
1017-
sources:
1018-
- before: |
1015+
after: |
10191016
<project>
10201017
<groupId>com.mycompany.app</groupId>
10211018
<artifactId>my-app</artifactId>
10221019
<version>1</version>
10231020
<properties>
1024-
<wro4j.version>1.8.0</wro4j.version>
1021+
<wro4j.version>1.10.1</wro4j.version>
10251022
</properties>
10261023
<build>
10271024
<plugins>
@@ -1033,20 +1030,23 @@ examples:
10331030
</plugins>
10341031
</build>
10351032
</project>
1036-
after: |
1033+
path: pom.xml
1034+
language: xml
1035+
- description: ''
1036+
sources:
1037+
- before: project
1038+
language: mavenProject
1039+
- before: |
10371040
<project>
10381041
<groupId>com.mycompany.app</groupId>
10391042
<artifactId>my-app</artifactId>
10401043
<version>1</version>
1041-
<properties>
1042-
<wro4j.version>1.10.1</wro4j.version>
1043-
</properties>
10441044
<build>
10451045
<plugins>
10461046
<plugin>
1047-
<groupId>ro.isdc.wro4j</groupId>
1048-
<artifactId>wro4j-maven-plugin</artifactId>
1049-
<version>${wro4j.version}</version>
1047+
<groupId>org.codehaus.mojo</groupId>
1048+
<artifactId>jaxb2-maven-plugin</artifactId>
1049+
<version>2.3.1</version>
10501050
</plugin>
10511051
</plugins>
10521052
</build>
@@ -3279,6 +3279,25 @@ examples:
32793279
type: specs.openrewrite.org/v1beta/example
32803280
recipeName: org.openrewrite.java.migrate.guava.NoGuava
32813281
examples:
3282+
- description: ''
3283+
sources:
3284+
- before: |
3285+
import com.google.common.base.MoreObjects;
3286+
3287+
class A {
3288+
Object foo(Object obj) {
3289+
return MoreObjects.firstNonNull(obj, "default");
3290+
}
3291+
}
3292+
after: |
3293+
import java.util.Objects;
3294+
3295+
class A {
3296+
Object foo(Object obj) {
3297+
return Objects.requireNonNullElse(obj, "default");
3298+
}
3299+
}
3300+
language: java
32823301
- description: ''
32833302
sources:
32843303
- before: |
@@ -3325,25 +3344,6 @@ examples:
33253344
}
33263345
}
33273346
language: java
3328-
- description: ''
3329-
sources:
3330-
- before: |
3331-
import com.google.common.base.MoreObjects;
3332-
3333-
class A {
3334-
Object foo(Object obj) {
3335-
return MoreObjects.firstNonNull(obj, "default");
3336-
}
3337-
}
3338-
after: |
3339-
import java.util.Objects;
3340-
3341-
class A {
3342-
Object foo(Object obj) {
3343-
return Objects.requireNonNullElse(obj, "default");
3344-
}
3345-
}
3346-
language: java
33473347
---
33483348
type: specs.openrewrite.org/v1beta/example
33493349
recipeName: org.openrewrite.java.migrate.guava.NoGuavaAtomicsNewReference

0 commit comments

Comments
 (0)