Skip to content

Commit f436aa0

Browse files
committed
fix: spotless plugin (downgrade to 2.43.0)
Signed-off-by: xstefank <[email protected]>
1 parent b2106f0 commit f436aa0

File tree

6 files changed

+94
-88
lines changed

6 files changed

+94
-88
lines changed

.github/workflows/fabric8-next-version-schedule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
distribution: temurin
2525
java-version: 17
2626
- name: Run unit tests
27-
run: ./mvnw ${MAVEN_ARGS} clean install --file pom.xml
27+
run: ./mvnw ${MAVEN_ARGS} clean install --file pom.xml -Dhighest-basedir=$PWD
2828

2929
build:
3030
uses: ./.github/workflows/build.yml

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/Utils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ public static boolean debugThreadPool() {
9898
return getBooleanFromSystemPropsOrDefault(DEBUG_THREAD_POOL_ENV_KEY, false);
9999
}
100100

101-
public static boolean getBooleanFromSystemPropsOrDefault(String propertyName, boolean defaultValue) {
101+
public static boolean getBooleanFromSystemPropsOrDefault(String propertyName,
102+
boolean defaultValue) {
102103
var property = System.getProperty(propertyName);
103104
if (property == null) {
104105
return defaultValue;
Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
package io.javaoperatorsdk.operator.processing;
22

3-
import io.fabric8.kubernetes.api.model.ObjectMeta;
4-
import io.javaoperatorsdk.operator.api.config.Utils;
53
import org.slf4j.MDC;
64

75
import io.fabric8.kubernetes.api.model.HasMetadata;
6+
import io.javaoperatorsdk.operator.api.config.Utils;
87
import io.javaoperatorsdk.operator.processing.event.ResourceID;
98

109
public class MDCUtils {
@@ -17,50 +16,51 @@ public class MDCUtils {
1716
private static final String GENERATION = "resource.generation";
1817
private static final String UID = "resource.uid";
1918
private static final String NO_NAMESPACE = "no namespace";
20-
private static final boolean enabled = Utils.getBooleanFromSystemPropsOrDefault(Utils.USE_MDC_ENV_KEY, true);
19+
private static final boolean enabled =
20+
Utils.getBooleanFromSystemPropsOrDefault(Utils.USE_MDC_ENV_KEY, true);
2121

2222
public static void addResourceIDInfo(ResourceID resourceID) {
23-
if (enabled) {
24-
MDC.put(NAME, resourceID.getName());
25-
MDC.put(NAMESPACE, resourceID.getNamespace().orElse(NO_NAMESPACE));
26-
}
23+
if (enabled) {
24+
MDC.put(NAME, resourceID.getName());
25+
MDC.put(NAMESPACE, resourceID.getNamespace().orElse(NO_NAMESPACE));
26+
}
2727
}
2828

2929
public static void removeResourceIDInfo() {
30-
if (enabled) {
31-
MDC.remove(NAME);
32-
MDC.remove(NAMESPACE);
33-
}
30+
if (enabled) {
31+
MDC.remove(NAME);
32+
MDC.remove(NAMESPACE);
33+
}
3434
}
3535

3636
public static void addResourceInfo(HasMetadata resource) {
37-
if (enabled) {
38-
MDC.put(API_VERSION, resource.getApiVersion());
39-
MDC.put(KIND, resource.getKind());
40-
final var metadata = resource.getMetadata();
41-
if (metadata != null) {
42-
MDC.put(NAME, metadata.getName());
43-
if (metadata.getNamespace() != null) {
44-
MDC.put(NAMESPACE, metadata.getNamespace());
45-
}
46-
MDC.put(RESOURCE_VERSION, metadata.getResourceVersion());
47-
if (metadata.getGeneration() != null) {
48-
MDC.put(GENERATION, metadata.getGeneration().toString());
49-
}
50-
MDC.put(UID, metadata.getUid());
51-
}
37+
if (enabled) {
38+
MDC.put(API_VERSION, resource.getApiVersion());
39+
MDC.put(KIND, resource.getKind());
40+
final var metadata = resource.getMetadata();
41+
if (metadata != null) {
42+
MDC.put(NAME, metadata.getName());
43+
if (metadata.getNamespace() != null) {
44+
MDC.put(NAMESPACE, metadata.getNamespace());
45+
}
46+
MDC.put(RESOURCE_VERSION, metadata.getResourceVersion());
47+
if (metadata.getGeneration() != null) {
48+
MDC.put(GENERATION, metadata.getGeneration().toString());
49+
}
50+
MDC.put(UID, metadata.getUid());
5251
}
52+
}
5353
}
5454

5555
public static void removeResourceInfo() {
56-
if (enabled) {
57-
MDC.remove(API_VERSION);
58-
MDC.remove(KIND);
59-
MDC.remove(NAME);
60-
MDC.remove(NAMESPACE);
61-
MDC.remove(RESOURCE_VERSION);
62-
MDC.remove(GENERATION);
63-
MDC.remove(UID);
64-
}
56+
if (enabled) {
57+
MDC.remove(API_VERSION);
58+
MDC.remove(KIND);
59+
MDC.remove(NAME);
60+
MDC.remove(NAMESPACE);
61+
MDC.remove(RESOURCE_VERSION);
62+
MDC.remove(GENERATION);
63+
MDC.remove(UID);
64+
}
6565
}
6666
}

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/ReconciliationDispatcher.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class ReconciliationDispatcher<P extends HasMetadata> {
5959
public ReconciliationDispatcher(Controller<P> controller) {
6060
this(controller,
6161
new CustomResourceFacade<>(controller.getCRClient(), controller.getConfiguration(),
62-
controller.getConfiguration().getConfigurationService().getResourceCloner()));
62+
controller.getConfiguration().getConfigurationService().getResourceCloner()));
6363
}
6464

6565
public PostExecutionControl<P> handleExecution(ExecutionScope<P> executionScope) {
@@ -368,8 +368,8 @@ static class CustomResourceFacade<R extends HasMetadata> {
368368
private final Cloner cloner;
369369

370370
public CustomResourceFacade(
371-
MixedOperation<R, KubernetesResourceList<R>, Resource<R>> resourceOperation,
372-
ControllerConfiguration<R> configuration, Cloner cloner) {
371+
MixedOperation<R, KubernetesResourceList<R>, Resource<R>> resourceOperation,
372+
ControllerConfiguration<R> configuration, Cloner cloner) {
373373
this.resourceOperation = resourceOperation;
374374
this.useSSA =
375375
configuration.getConfigurationService().useSSAToPatchPrimaryResource();

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/changenamespace/ChangeNamespaceTestReconciler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public UpdateControl<ChangeNamespaceTestCustomResource> reconcile(
5252

5353
var statusPatchResource = new ChangeNamespaceTestCustomResource();
5454
statusPatchResource.setMetadata(new ObjectMetaBuilder()
55-
.withName(primary.getMetadata().getName())
56-
.withNamespace(primary.getMetadata().getNamespace())
57-
.build());
55+
.withName(primary.getMetadata().getName())
56+
.withNamespace(primary.getMetadata().getNamespace())
57+
.build());
5858
statusPatchResource.setStatus(new ChangeNamespaceTestCustomResourceStatus());
5959
var statusUpdates = primary.getStatus().getNumberOfStatusUpdates();
6060
statusPatchResource.getStatus().setNumberOfStatusUpdates(statusUpdates + 1);

pom.xml

Lines changed: 50 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
<maven-install-plugin.version>3.1.3</maven-install-plugin.version>
9292
<git-commit-id-maven-plugin.version>9.0.1</git-commit-id-maven-plugin.version>
9393
<jib-maven-plugin.version>3.4.4</jib-maven-plugin.version>
94-
<spotless.version>2.44.3</spotless.version>
94+
<spotless.version>2.43.0</spotless.version>
9595
</properties>
9696

9797
<dependencyManagement>
@@ -327,53 +327,58 @@
327327
<excludedGroups>WatchPermissionAwareTest</excludedGroups>
328328
</configuration>
329329
</plugin>
330+
<plugin>
331+
<groupId>org.commonjava.maven.plugins</groupId>
332+
<artifactId>directory-maven-plugin</artifactId>
333+
<version>0.1</version>
334+
<executions>
335+
<execution>
336+
<id>directories</id>
337+
<goals>
338+
<goal>highest-basedir</goal>
339+
</goals>
340+
<phase>initialize</phase>
341+
<configuration>
342+
<property>highest-basedir</property>
343+
</configuration>
344+
</execution>
345+
</executions>
346+
</plugin>
347+
<plugin>
348+
<groupId>com.diffplug.spotless</groupId>
349+
<artifactId>spotless-maven-plugin</artifactId>
350+
<configuration>
351+
<pom>
352+
<includes>
353+
<include>pom.xml</include>
354+
<include>./**/pom.xml</include>
355+
</includes>
356+
<sortPom>
357+
<expandEmptyElements>false</expandEmptyElements>
358+
</sortPom>
359+
</pom>
360+
<java>
361+
<eclipse>
362+
<file>${highest-basedir}/contributing/eclipse-google-style.xml</file>
363+
</eclipse>
364+
<importOrder>
365+
<order>java,javax,org,io,com,,\#</order>
366+
</importOrder>
367+
<removeUnusedImports/>
368+
</java>
369+
</configuration>
370+
<executions>
371+
<execution>
372+
<goals>
373+
<goal>apply</goal>
374+
</goals>
375+
<phase>compile</phase>
376+
</execution>
377+
</executions>
378+
</plugin>
330379
</plugins>
331380
</build>
332381
<profiles>
333-
<profile>
334-
<id>spotless</id>
335-
<activation>
336-
<file>
337-
<exists>contributing</exists>
338-
</file>
339-
</activation>
340-
<build>
341-
<plugins>
342-
<plugin>
343-
<groupId>com.diffplug.spotless</groupId>
344-
<artifactId>spotless-maven-plugin</artifactId>
345-
<configuration>
346-
<pom>
347-
<includes>
348-
<include>pom.xml</include>
349-
<include>./**/pom.xml</include>
350-
</includes>
351-
<sortPom>
352-
<expandEmptyElements>false</expandEmptyElements>
353-
</sortPom>
354-
</pom>
355-
<java>
356-
<eclipse>
357-
<file>contributing/eclipse-google-style.xml</file>
358-
</eclipse>
359-
<importOrder>
360-
<file>contributing/eclipse.importorder</file>
361-
</importOrder>
362-
<removeUnusedImports/>
363-
</java>
364-
</configuration>
365-
<executions>
366-
<execution>
367-
<goals>
368-
<goal>apply</goal>
369-
</goals>
370-
<phase>compile</phase>
371-
</execution>
372-
</executions>
373-
</plugin>
374-
</plugins>
375-
</build>
376-
</profile>
377382
<profile>
378383
<id>integration-tests</id>
379384
<build>

0 commit comments

Comments
 (0)