Skip to content

Commit bafe717

Browse files
authored
fix(kubernetes-gradle-plugin): SonarQube AI fixes (3581) (3626)
fix: uses safe Boolean check instead of error prone unboxing Signed-off-by: jonathan.vila <[email protected]> --- fix: rename variable to not hide variable Signed-off-by: jonathan.vila <[email protected]> --- fix: remove commented line Signed-off-by: jonathan.vila <[email protected]> --- Merge branch 'master' of github.com:jonathanvila/jkube --- fix: removed unused temporary variable and assignment Signed-off-by: jonathan.vila <[email protected]> --- fix: replace lambda with method reference Signed-off-by: jonathan.vila <[email protected]> --- fix: replace string with constant Signed-off-by: jonathan.vila <[email protected]> --- fix: use system new line separator Signed-off-by: jonathan.vila <[email protected]> --- fix: rename lambda to not hide field Signed-off-by: jonathan.vila <[email protected]> --- Merge remote-tracking branch 'upstream/master' into ai-sonar-grdle-plugin-fix --- fix: use constant instead of repeated literal Signed-off-by: jonathan.vila <[email protected]> --- Undo method reference fix due to problems with Java 8
1 parent 954b72a commit bafe717

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

gradle-plugin/it/src/test/java/org/eclipse/jkube/gradle/plugin/tests/HelmIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void k8sResourceHelmFromFragment_whenRun_generatesHelmChart(String projectName)
5959
})
6060
void k8sResourceHelmFromFragment_whenRun_generatesHelmValues(String projectName) throws Exception {
6161
// When
62-
final BuildResult result = gradleRunner.withITProject(projectName)
62+
gradleRunner.withITProject(projectName)
6363
.withArguments("clean", "k8sResource", "k8sHelm").build();
6464
// Then
6565
ResourceVerify.verifyResourceDescriptors(

gradle-plugin/kubernetes/src/main/java/org/eclipse/jkube/gradle/plugin/KubernetesExtension.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,13 @@
111111
public abstract class KubernetesExtension {
112112

113113
private static final boolean DEFAULT_OFFLINE = false;
114-
private static final Path DEFAULT_KUBERNETES_MANIFEST = Paths.get("META-INF", "jkube", "kubernetes.yml");
115-
private static final Path DEFAULT_KUBERNETES_TEMPLATE = Paths.get("META-INF", "jkube", "kubernetes");
116-
private static final Path DEFAULT_JSON_LOG_DIR = Paths.get("jkube","applyJson");
117-
private static final Path DEFAULT_RESOURCE_SOURCE_DIR = Paths.get("src", "main", "jkube");
118-
private static final Path DEFAULT_RESOURCE_TARGET_DIR = Paths.get("META-INF", "jkube");
114+
private static final String META_INF = "META-INF";
115+
private static final String JKUBE = "jkube";
116+
private static final Path DEFAULT_KUBERNETES_MANIFEST = Paths.get(META_INF, JKUBE, "kubernetes.yml");
117+
private static final Path DEFAULT_KUBERNETES_TEMPLATE = Paths.get(META_INF, JKUBE, "kubernetes");
118+
private static final Path DEFAULT_JSON_LOG_DIR = Paths.get(JKUBE, "applyJson");
119+
private static final Path DEFAULT_RESOURCE_SOURCE_DIR = Paths.get("src", "main", JKUBE);
120+
private static final Path DEFAULT_RESOURCE_TARGET_DIR = Paths.get(META_INF, JKUBE);
119121
private static final Path DEFAULT_WORK_DIR = Paths.get("jkube-temp");
120122

121123
public transient JavaProject javaProject;

gradle-plugin/kubernetes/src/test/java/org/eclipse/jkube/gradle/plugin/task/KubernetesConfigViewTaskTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ void runTask_withManualSettings_shouldLogThem() {
4848
configViewTask.runTask();
4949
// Then
5050
verify(taskEnvironment.logger, times(1))
51-
.lifecycle(matches(String.format("k8s: %n---\noffline: true\nbuildStrategy: \"s2i\"")));
51+
.lifecycle(matches(String.format("k8s: %n---%noffline: true%nbuildStrategy: \"s2i\"")));
5252
}
5353
}

gradle-plugin/kubernetes/src/test/java/org/eclipse/jkube/gradle/plugin/task/KubernetesRemoteDevTaskTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ void runTask_withException_shouldStop() {
8181
// Then
8282
assertThat(remoteDevelopmentService.constructed())
8383
.singleElement()
84-
.satisfies(remoteDevelopmentService -> verify(remoteDevelopmentService, times(1)).stop());
84+
.satisfies(service -> verify(service, times(1)).stop());
8585
}
8686
}

0 commit comments

Comments
 (0)