Skip to content

Commit

Permalink
refactor: Set default estimated effort
Browse files Browse the repository at this point in the history
Co-authored-by: Moderne <[email protected]>
  • Loading branch information
jkschneider and TeamModerne committed Mar 11, 2022
1 parent 13be4ea commit a305a16
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import org.openrewrite.java.search.UsesType;
import org.openrewrite.java.tree.J;

import java.time.Duration;

public class ConfigPropertiesToConfigMapping extends Recipe {
@Override
public String getDisplayName() {
Expand Down Expand Up @@ -59,4 +61,9 @@ public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, Ex
return cd;
}
}

@Override
public Duration getEstimatedEffortPerOccurrence() {
return Duration.ofMinutes(5);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.openrewrite.xml.ChangeTagValueVisitor;
import org.openrewrite.xml.tree.Xml;

import java.time.Duration;
import java.util.Optional;

@Value
Expand All @@ -42,6 +43,11 @@ public String getDescription() {
return "Configures the `quarkus-maven-plugin` with reasonable defaults, such as default activated `goals` and `<extensions>` configuration.";
}

@Override
public Duration getEstimatedEffortPerOccurrence() {
return Duration.ofMinutes(5);
}

@Override
protected TreeVisitor<?, ExecutionContext> getVisitor() {
return new ConfigureQuarkusMavenPluginWithReasonableDefaultsVisitor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.openrewrite.xml.search.FindTags;
import org.openrewrite.xml.tree.Xml;

import java.time.Duration;
import java.util.Optional;

public class MigrateQuarkusMavenPluginNativeImageGoal extends Recipe {
Expand Down Expand Up @@ -95,4 +96,9 @@ public Xml.Document visitDocument(Xml.Document document, ExecutionContext ctx) {
}
}

@Override
public Duration getEstimatedEffortPerOccurrence() {
return Duration.ofMinutes(5);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import org.openrewrite.java.search.UsesMethod;
import org.openrewrite.java.tree.J;

import java.time.Duration;

public class MultiTransformHotStreamToMultiHotStream extends Recipe {
private static final MethodMatcher HOT_STREAM_METHOD_MATCHER = new MethodMatcher("io.smallrye.mutiny.groups.MultiTransform toHotStream()");

Expand All @@ -37,6 +39,11 @@ public String getDescription() {
return "Replace Mutiny API usages of `multi.transform().toHotStream()` with `multi.toHotStream()`.";
}

@Override
public Duration getEstimatedEffortPerOccurrence() {
return Duration.ofMinutes(5);
}

@Override
protected @Nullable TreeVisitor<?, ExecutionContext> getSingleSourceApplicableTest() {
return new UsesMethod<>(HOT_STREAM_METHOD_MATCHER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import org.openrewrite.java.tree.J;
import org.openrewrite.java.tree.TypeUtils;

import java.time.Duration;

public class GrpcServiceAnnotationToGrpcClient extends Recipe {
private static final String GRPC_SERVICE_ANNOTATION_FQN = "io.quarkus.grpc.runtime.annotations.GrpcService";
private static final String GRPC_CLIENT_ANNOTATION_FQN = "io.quarkus.grpc.GrpcClient";
Expand All @@ -40,6 +42,11 @@ public String getDescription() {
return "The `@GrpcService` annotation is replaced with `@GrpcClient` in Quarkus 2.x. Removes the optional `@GrpcClient.value()` unless the service name is different from the name of annotated element.";
}

@Override
public Duration getEstimatedEffortPerOccurrence() {
return Duration.ofMinutes(5);
}

@Override
protected TreeVisitor<?, ExecutionContext> getSingleSourceApplicableTest() {
return new UsesType<>(GRPC_SERVICE_ANNOTATION_FQN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import org.openrewrite.maven.search.FindPlugin;
import org.openrewrite.xml.tree.Xml;

import java.time.Duration;

public class RemoveAvroMavenPlugin extends Recipe {
@Override
public String getDisplayName() {
Expand All @@ -35,6 +37,11 @@ public String getDescription() {
return "Removes the `avro-maven-plugin` if the `quarkus-maven-plugin` is found in the project's `pom.xml`. Avro has been integrated with the Quarkus code generation mechanism. This replaces the need to use the Avro plugin.";
}

@Override
public Duration getEstimatedEffortPerOccurrence() {
return Duration.ofMinutes(5);
}

@Override
protected @Nullable TreeVisitor<?, ExecutionContext> getApplicableTest() {
return new MavenIsoVisitor<ExecutionContext>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.openrewrite.java.search.UsesType;
import org.openrewrite.java.tree.J;

import java.time.Duration;
import java.util.Collections;

public class UseIdentifierOnDefaultKafkaBroker extends Recipe {
Expand All @@ -51,6 +52,11 @@ public String getDescription() {
return "Use `@io.smallrye.common.annotation.Identifier` on default kafka broker configuration.";
}

@Override
public Duration getEstimatedEffortPerOccurrence() {
return Duration.ofMinutes(5);
}

@Override
protected TreeVisitor<?, ExecutionContext> getSingleSourceApplicableTest() {
return new UsesType<>("javax.inject.Named");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import org.openrewrite.java.tree.JavaType;
import org.openrewrite.java.tree.TypeUtils;

import java.time.Duration;

public class UsePanacheEntityBaseStaticMethods extends Recipe {
private static final MethodMatcher GET_ENTITY_MANAGER = new MethodMatcher("io.quarkus.hibernate.orm.panache.PanacheEntityBase getEntityManager()");
private static final MethodMatcher FLUSH = new MethodMatcher("io.quarkus.hibernate.orm.panache.PanacheEntityBase flush()");
Expand All @@ -41,6 +43,11 @@ public String getDescription() {
return "The `getEntityManager()` and the `flush()` methods of `PanacheEntityBase` are now static methods.";
}

@Override
public Duration getEstimatedEffortPerOccurrence() {
return Duration.ofMinutes(5);
}

@Override
protected TreeVisitor<?, ExecutionContext> getSingleSourceApplicableTest() {
return new JavaIsoVisitor<ExecutionContext>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.openrewrite.java.tree.JavaType;
import org.openrewrite.java.tree.TypeUtils;

import java.time.Duration;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand Down Expand Up @@ -66,6 +67,11 @@ public String getDescription() {
return "The `persist()` and `persistAndFlush()` methods now return an `Uni<T extends PanacheEntityBase>` instead of an `Uni<Void>` to allow chaining the methods.";
}

@Override
public Duration getEstimatedEffortPerOccurrence() {
return Duration.ofMinutes(5);
}

@Override
protected @Nullable TreeVisitor<?, ExecutionContext> getSingleSourceApplicableTest() {
return new JavaIsoVisitor<ExecutionContext>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.openrewrite.java.tree.JavaType;
import org.openrewrite.java.tree.TypeUtils;

import java.time.Duration;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand Down Expand Up @@ -81,6 +82,11 @@ public J.CompilationUnit visitCompilationUnit(J.CompilationUnit cu, ExecutionCon
};
}

@Override
public Duration getEstimatedEffortPerOccurrence() {
return Duration.ofMinutes(5);
}

@Override
protected TreeVisitor<?, ExecutionContext> getVisitor() {
return new UseReactivePanacheMongoEntityBaseUniTVisitor();
Expand Down

0 comments on commit a305a16

Please sign in to comment.