Skip to content

Commit

Permalink
fix(kubernetes-gradle-plugin): SonarQube AI fixes (3581) (3626)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jonathanvila authored Feb 4, 2025
1 parent 954b72a commit bafe717
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void k8sResourceHelmFromFragment_whenRun_generatesHelmChart(String projectName)
})
void k8sResourceHelmFromFragment_whenRun_generatesHelmValues(String projectName) throws Exception {
// When
final BuildResult result = gradleRunner.withITProject(projectName)
gradleRunner.withITProject(projectName)
.withArguments("clean", "k8sResource", "k8sHelm").build();
// Then
ResourceVerify.verifyResourceDescriptors(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,13 @@
public abstract class KubernetesExtension {

private static final boolean DEFAULT_OFFLINE = false;
private static final Path DEFAULT_KUBERNETES_MANIFEST = Paths.get("META-INF", "jkube", "kubernetes.yml");
private static final Path DEFAULT_KUBERNETES_TEMPLATE = Paths.get("META-INF", "jkube", "kubernetes");
private static final Path DEFAULT_JSON_LOG_DIR = Paths.get("jkube","applyJson");
private static final Path DEFAULT_RESOURCE_SOURCE_DIR = Paths.get("src", "main", "jkube");
private static final Path DEFAULT_RESOURCE_TARGET_DIR = Paths.get("META-INF", "jkube");
private static final String META_INF = "META-INF";
private static final String JKUBE = "jkube";
private static final Path DEFAULT_KUBERNETES_MANIFEST = Paths.get(META_INF, JKUBE, "kubernetes.yml");
private static final Path DEFAULT_KUBERNETES_TEMPLATE = Paths.get(META_INF, JKUBE, "kubernetes");
private static final Path DEFAULT_JSON_LOG_DIR = Paths.get(JKUBE, "applyJson");
private static final Path DEFAULT_RESOURCE_SOURCE_DIR = Paths.get("src", "main", JKUBE);
private static final Path DEFAULT_RESOURCE_TARGET_DIR = Paths.get(META_INF, JKUBE);
private static final Path DEFAULT_WORK_DIR = Paths.get("jkube-temp");

public transient JavaProject javaProject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ void runTask_withManualSettings_shouldLogThem() {
configViewTask.runTask();
// Then
verify(taskEnvironment.logger, times(1))
.lifecycle(matches(String.format("k8s: %n---\noffline: true\nbuildStrategy: \"s2i\"")));
.lifecycle(matches(String.format("k8s: %n---%noffline: true%nbuildStrategy: \"s2i\"")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ void runTask_withException_shouldStop() {
// Then
assertThat(remoteDevelopmentService.constructed())
.singleElement()
.satisfies(remoteDevelopmentService -> verify(remoteDevelopmentService, times(1)).stop());
.satisfies(service -> verify(service, times(1)).stop());
}
}

0 comments on commit bafe717

Please sign in to comment.