Skip to content

Commit 869dcb3

Browse files
rudy-regazzoni-sonarsourcesonartech
authored andcommitted
SONARIAC-1865 S6893 should not raise on comment for specific case with dash
1 parent 6be769d commit 869dcb3

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

iac-extensions/kubernetes/src/main/java/org/sonar/iac/kubernetes/checks/WhitespaceBracesCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private static void checkBrackets(KubernetesCheckContext kubernetesContext, Stri
7878
}
7979

8080
private static boolean isHelmComment(String helmContent) {
81-
return helmContent.startsWith("/*");
81+
return helmContent.startsWith("/*") || helmContent.endsWith("*/");
8282
}
8383

8484
private static String readContentWithComments(KubernetesCheckContext ctx) {

iac-extensions/kubernetes/src/test/java/org/sonar/iac/kubernetes/checks/WhitespaceBracesCheckTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ void shouldDetectIssues() {
4242
issue(22, 29, 22, 31, OPEN),
4343
issue(23, 60, 23, 62, CLOSE),
4444
issue(24, 6, 24, 8, CLOSE),
45-
issue(39, 38, 39, 40, CLOSE),
46-
issue(41, 12, 41, 14, OPEN),
47-
issue(48, 36, 48, 38, CLOSE),
48-
issue(51, 12, 51, 14, OPEN),
49-
issue(51, 35, 51, 37, CLOSE),
50-
issue(52, 13, 52, 15, OPEN),
51-
issue(52, 36, 52, 38, CLOSE),
52-
issue(53, 46, 53, 48, CLOSE),
53-
issue(54, 47, 54, 49, CLOSE),
54-
issue(57, 13, 57, 15, OPEN)));
45+
issue(41, 38, 41, 40, CLOSE),
46+
issue(43, 12, 43, 14, OPEN),
47+
issue(50, 36, 50, 38, CLOSE),
48+
issue(53, 12, 53, 14, OPEN),
49+
issue(53, 35, 53, 37, CLOSE),
50+
issue(54, 13, 54, 15, OPEN),
51+
issue(54, 36, 54, 38, CLOSE),
52+
issue(55, 46, 55, 48, CLOSE),
53+
issue(56, 47, 56, 49, CLOSE),
54+
issue(59, 13, 59, 15, OPEN)));
5555
}
5656

5757
@Test

iac-extensions/kubernetes/src/test/resources/checks/WhitespaceBracesCheckTest/helm/templates/whitespace-braces.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ spec:
2525

2626
{{/* Compliant */}}
2727
{{- /* Compliant */ -}}
28+
{{- /* Compliant */}}
29+
{{/* Compliant */ -}}
2830

2931
{{ if .Values.containerName3 }}
3032
{{ print "- name: " | indent 4 }}{{ print .Values.containerName3 }}

0 commit comments

Comments
 (0)