Skip to content

Commit 372f6ba

Browse files
committed
fix: spotless plugin activation issue
Signed-off-by: xstefank <[email protected]>
1 parent 2d9d57c commit 372f6ba

File tree

511 files changed

+3263
-5621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

511 files changed

+3263
-5621
lines changed

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
cache: 'maven'
2727
- name: Check code format
2828
run: |
29-
./mvnw ${MAVEN_ARGS} spotless:check --file pom.xml
29+
./mvnw ${MAVEN_ARGS} spotless:check --file pom.xml -Dhighest-basedir=$PWD
3030
- name: Run unit tests
3131
run: ./mvnw ${MAVEN_ARGS} clean install -Pno-apt --file pom.xml
3232

bootstrapper-maven-plugin/src/main/java/io/javaoperatorsdk/boostrapper/Bootstrapper.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ public class Bootstrapper {
2727
private static final Map<String, String> TOP_LEVEL_STATIC_FILES =
2828
Map.of("_.gitignore", ".gitignore", "README.md", "README.md");
2929
private static final List<String> JAVA_FILES =
30-
List.of("CustomResource.java", "Reconciler.java",
31-
"Spec.java", "Status.java");
30+
List.of("CustomResource.java", "Reconciler.java", "Spec.java", "Status.java");
3231

3332
public void create(File targetDir, String groupId, String artifactId) {
3433
try {
@@ -67,8 +66,7 @@ private void addJavaFiles(File projectDir, String groupId, String artifactId) {
6766
addTemplatedFile(projectDir, "Runner.java", groupId, artifactId, targetDir, null);
6867
addTemplatedFile(projectDir, "ConfigMapDependentResource.java", groupId, artifactId,
6968
targetDir, null);
70-
addTemplatedFile(projectDir, "ReconcilerIntegrationTest.java", groupId,
71-
artifactId,
69+
addTemplatedFile(projectDir, "ReconcilerIntegrationTest.java", groupId, artifactId,
7270
targetTestDir, artifactClassId(artifactId) + "ReconcilerIntegrationTest.java");
7371
} catch (IOException e) {
7472
throw new RuntimeException(e);
@@ -89,10 +87,9 @@ private void addTemplatedFile(File projectDir, String fileName, String groupId,
8987
private void addTemplatedFile(File projectDir, String fileName, String groupId, String artifactId,
9088
File targetDir, String targetFileName) {
9189
try {
92-
var values = Map.of("groupId", groupId, "artifactId", artifactId,
93-
"artifactClassId", artifactClassId(artifactId),
94-
"josdkVersion", Versions.JOSDK,
95-
"fabric8Version", Versions.KUBERNETES_CLIENT);
90+
var values = Map.of("groupId", groupId, "artifactId", artifactId, "artifactClassId",
91+
artifactClassId(artifactId), "josdkVersion", Versions.JOSDK, "fabric8Version",
92+
Versions.KUBERNETES_CLIENT);
9693

9794
var mustache = mustacheFactory.compile("templates/" + fileName);
9895
var targetFile = new File(targetDir == null ? projectDir : targetDir,
@@ -132,8 +129,7 @@ private void addStaticFile(File targetDir, String fileName, String targetFilenam
132129

133130
public static String artifactClassId(String artifactId) {
134131
var parts = artifactId.split("-");
135-
return Arrays.stream(parts).map(p -> p.substring(0, 1)
136-
.toUpperCase() + p.substring(1))
132+
return Arrays.stream(parts).map(p -> p.substring(0, 1).toUpperCase() + p.substring(1))
137133
.collect(Collectors.joining(""));
138134
}
139135

bootstrapper-maven-plugin/src/main/java/io/javaoperatorsdk/boostrapper/BootstrapperMojo.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@
88
import org.apache.maven.plugins.annotations.Parameter;
99

1010
@Mojo(name = "create", requiresProject = false)
11-
public class BootstrapperMojo
12-
extends AbstractMojo {
11+
public class BootstrapperMojo extends AbstractMojo {
1312

1413
@Parameter(defaultValue = "${projectGroupId}")
1514
protected String projectGroupId;
1615

1716
@Parameter(defaultValue = "${projectArtifactId}")
1817
protected String projectArtifactId;
1918

20-
public void execute()
21-
throws MojoExecutionException {
19+
public void execute() throws MojoExecutionException {
2220
String userDir = System.getProperty("user.dir");
2321
new Bootstrapper().create(new File(userDir), projectGroupId, projectArtifactId);
2422
}

bootstrapper-maven-plugin/src/test/java/io/javaoperatorsdk/bootstrapper/BootstrapperTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ void copiesFilesToTarget() {
3030

3131
private void assertProjectCompiles() {
3232
try {
33-
var process = Runtime.getRuntime()
34-
.exec(
35-
"mvn clean install -f target/test-project/pom.xml -DskipTests -Dspotless.apply.skip");
33+
var process = Runtime.getRuntime().exec(
34+
"mvn clean install -f target/test-project/pom.xml -DskipTests -Dspotless.apply.skip");
3635

3736
BufferedReader stdOut = new BufferedReader(new InputStreamReader(process.getInputStream()));
3837

caffeine-bounded-cache-support/src/main/java/io/javaoperatorsdk/operator/processing/event/source/cache/CaffeineBoundedItemStores.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,8 @@ private CaffeineBoundedItemStores() {}
3939
*/
4040
@SuppressWarnings("unused")
4141
public static <R extends HasMetadata> BoundedItemStore<R> boundedItemStore(
42-
KubernetesClient client, Class<R> rClass,
43-
Duration accessExpireDuration) {
44-
Cache<String, R> cache = Caffeine.newBuilder()
45-
.expireAfterAccess(accessExpireDuration)
46-
.build();
42+
KubernetesClient client, Class<R> rClass, Duration accessExpireDuration) {
43+
Cache<String, R> cache = Caffeine.newBuilder().expireAfterAccess(accessExpireDuration).build();
4744
return boundedItemStore(client, rClass, cache);
4845
}
4946

caffeine-bounded-cache-support/src/test/java/io/javaoperatorsdk/operator/processing/event/source/cache/CaffeineBoundedCacheClusterScopeIT.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,16 @@ public class CaffeineBoundedCacheClusterScopeIT
1717
extends BoundedCacheTestBase<BoundedCacheClusterScopeTestCustomResource> {
1818

1919
@RegisterExtension
20-
LocallyRunOperatorExtension extension =
21-
LocallyRunOperatorExtension.builder()
22-
.withReconciler(new BoundedCacheClusterScopeTestReconciler(), o -> {
23-
o.withItemStore(boundedItemStore(
24-
new KubernetesClientBuilder().build(),
25-
BoundedCacheClusterScopeTestCustomResource.class,
26-
Duration.ofMinutes(1),
27-
1));
28-
})
29-
.build();
20+
LocallyRunOperatorExtension extension = LocallyRunOperatorExtension.builder()
21+
.withReconciler(new BoundedCacheClusterScopeTestReconciler(), o -> {
22+
o.withItemStore(boundedItemStore(new KubernetesClientBuilder().build(),
23+
BoundedCacheClusterScopeTestCustomResource.class, Duration.ofMinutes(1), 1));
24+
}).build();
3025

3126
@Override
3227
BoundedCacheClusterScopeTestCustomResource createTestResource(int index) {
3328
var res = new BoundedCacheClusterScopeTestCustomResource();
34-
res.setMetadata(new ObjectMetaBuilder()
35-
.withName(RESOURCE_NAME_PREFIX + index)
36-
.build());
29+
res.setMetadata(new ObjectMetaBuilder().withName(RESOURCE_NAME_PREFIX + index).build());
3730
res.setSpec(new BoundedCacheTestSpec());
3831
res.getSpec().setData(INITIAL_DATA_PREFIX + index);
3932
res.getSpec().setTargetNamespace(extension.getNamespace());

caffeine-bounded-cache-support/src/test/java/io/javaoperatorsdk/operator/processing/event/source/cache/CaffeineBoundedCacheNamespacedIT.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,13 @@ class CaffeineBoundedCacheNamespacedIT
1919
@RegisterExtension
2020
LocallyRunOperatorExtension extension =
2121
LocallyRunOperatorExtension.builder().withReconciler(new BoundedCacheTestReconciler(), o -> {
22-
o.withItemStore(boundedItemStore(
23-
new KubernetesClientBuilder().build(), BoundedCacheTestCustomResource.class,
24-
Duration.ofMinutes(1),
25-
1));
26-
})
27-
.build();
22+
o.withItemStore(boundedItemStore(new KubernetesClientBuilder().build(),
23+
BoundedCacheTestCustomResource.class, Duration.ofMinutes(1), 1));
24+
}).build();
2825

2926
BoundedCacheTestCustomResource createTestResource(int index) {
3027
var res = new BoundedCacheTestCustomResource();
31-
res.setMetadata(new ObjectMetaBuilder()
32-
.withName(RESOURCE_NAME_PREFIX + index)
33-
.build());
28+
res.setMetadata(new ObjectMetaBuilder().withName(RESOURCE_NAME_PREFIX + index).build());
3429
res.setSpec(new BoundedCacheTestSpec());
3530
res.getSpec().setData(INITIAL_DATA_PREFIX + index);
3631
res.getSpec().setTargetNamespace(extension.getNamespace());

caffeine-bounded-cache-support/src/test/java/io/javaoperatorsdk/operator/processing/event/source/cache/sample/AbstractTestReconciler.java

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,9 @@ public abstract class AbstractTestReconciler<P extends CustomResource<BoundedCac
3737
public static final String DATA_KEY = "dataKey";
3838

3939
@Override
40-
public UpdateControl<P> reconcile(
41-
P resource,
42-
Context<P> context) {
40+
public UpdateControl<P> reconcile(P resource, Context<P> context) {
4341
var maybeConfigMap = context.getSecondaryResource(ConfigMap.class);
44-
maybeConfigMap.ifPresentOrElse(
45-
cm -> updateConfigMapIfNeeded(cm, resource, context),
42+
maybeConfigMap.ifPresentOrElse(cm -> updateConfigMapIfNeeded(cm, resource, context),
4643
() -> createConfigMap(resource, context));
4744
ensureStatus(resource);
4845
log.info("Reconciled: {}", resource.getMetadata().getName());
@@ -59,32 +56,24 @@ protected void updateConfigMapIfNeeded(ConfigMap cm, P resource, Context<P> cont
5956

6057
protected void createConfigMap(P resource, Context<P> context) {
6158
var cm = new ConfigMapBuilder()
62-
.withMetadata(new ObjectMetaBuilder()
63-
.withName(resource.getMetadata().getName())
64-
.withNamespace(resource.getSpec().getTargetNamespace())
65-
.build())
66-
.withData(Map.of(DATA_KEY, resource.getSpec().getData()))
67-
.build();
59+
.withMetadata(new ObjectMetaBuilder().withName(resource.getMetadata().getName())
60+
.withNamespace(resource.getSpec().getTargetNamespace()).build())
61+
.withData(Map.of(DATA_KEY, resource.getSpec().getData())).build();
6862
cm.addOwnerReference(resource);
6963
context.getClient().configMaps().resource(cm).create();
7064
}
7165

7266
@Override
73-
public List<EventSource<?, P>> prepareEventSources(
74-
EventSourceContext<P> context) {
75-
76-
var boundedItemStore =
77-
boundedItemStore(new KubernetesClientBuilder().build(),
78-
ConfigMap.class, Duration.ofMinutes(1), 1); // setting max size for testing purposes
79-
80-
var es = new InformerEventSource<>(
81-
InformerEventSourceConfiguration.from(ConfigMap.class, primaryClass())
82-
.withItemStore(boundedItemStore)
83-
.withSecondaryToPrimaryMapper(
84-
Mappers.fromOwnerReferences(context.getPrimaryResourceClass(),
85-
this instanceof BoundedCacheClusterScopeTestReconciler))
86-
.build(),
87-
context);
67+
public List<EventSource<?, P>> prepareEventSources(EventSourceContext<P> context) {
68+
69+
var boundedItemStore = boundedItemStore(new KubernetesClientBuilder().build(), ConfigMap.class,
70+
Duration.ofMinutes(1), 1); // setting max size for testing purposes
71+
72+
var es = new InformerEventSource<>(InformerEventSourceConfiguration
73+
.from(ConfigMap.class, primaryClass()).withItemStore(boundedItemStore)
74+
.withSecondaryToPrimaryMapper(Mappers.fromOwnerReferences(context.getPrimaryResourceClass(),
75+
this instanceof BoundedCacheClusterScopeTestReconciler))
76+
.build(), context);
8877

8978
return List.of(es);
9079
}
@@ -96,14 +85,11 @@ private void ensureStatus(P resource) {
9685
}
9786

9887
public static <R extends HasMetadata> BoundedItemStore<R> boundedItemStore(
99-
KubernetesClient client, Class<R> rClass,
100-
Duration accessExpireDuration,
88+
KubernetesClient client, Class<R> rClass, Duration accessExpireDuration,
10189
// max size is only for testing purposes
10290
long cacheMaxSize) {
103-
Cache<String, R> cache = Caffeine.newBuilder()
104-
.expireAfterAccess(accessExpireDuration)
105-
.maximumSize(cacheMaxSize)
106-
.build();
91+
Cache<String, R> cache = Caffeine.newBuilder().expireAfterAccess(accessExpireDuration)
92+
.maximumSize(cacheMaxSize).build();
10793
return CaffeineBoundedItemStores.boundedItemStore(client, rClass, cache);
10894
}
10995

caffeine-bounded-cache-support/src/test/java/io/javaoperatorsdk/operator/processing/event/source/cache/sample/clusterscope/BoundedCacheClusterScopeTestReconciler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import io.javaoperatorsdk.operator.processing.event.source.cache.sample.AbstractTestReconciler;
55

66
@ControllerConfiguration
7-
public class BoundedCacheClusterScopeTestReconciler extends
8-
AbstractTestReconciler<BoundedCacheClusterScopeTestCustomResource> {
7+
public class BoundedCacheClusterScopeTestReconciler
8+
extends AbstractTestReconciler<BoundedCacheClusterScopeTestCustomResource> {
99

1010
@Override
1111
protected Class<BoundedCacheClusterScopeTestCustomResource> primaryClass() {

contributing/eclipse-google-style.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
6666
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
6767
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
68-
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="false"/>
68+
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
6969
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
7070
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
7171
<setting id="org.eclipse.jdt.core.formatter.wrap_non_simple_local_variable_annotation" value="true"/>

0 commit comments

Comments
 (0)