7
7
{{- $s := 0 -}}
8
8
9
9
{{- /* Range over the linted files */ -}}
10
-
11
10
[
12
11
{{- range $jdx, $file := .Files -}}
13
-
14
- {{- $path := .Path -}}
15
-
16
- {{- /* Range over the file's alerts */ -}}
17
-
18
- {{- if $jdx -}}, {{- end -}}
19
- {{- range $idx, $a := .Alerts -}}
20
-
21
- {{- $error := "" -}}
22
- {{- if eq .Severity "error " -}}
23
- {{- $error = "error " -}}
24
- {{- $e = add1 $e -}}
25
- {{- else if eq .Severity "warning" -}}
26
- {{- $error = "warning " -}}
27
- {{- $w = add1 $w -}}
28
- {{- else - }}
29
- {{- $error = "suggestion" -}}
30
- {{- $s = add1 $s -}}
31
- {{- end }}
32
-
33
- {{- /* Variables setup */ -}}
34
-
35
- {{- $loc := printf "%d" .Line -}}
36
- {{- $check := printf "%s " .Check -}}
37
- {{- $message : = printf "%s " .Message -}}
38
- {{- if $idx -}}, {{- end -}}
39
-
40
- {{- /* Output */ -}}
41
-
42
- {
43
- "body": "🤖 **[{{ $error }}] {{$check}}**: {{ $message }}",
44
- "path": "{{ $path }}",
45
- "line": {{ $loc }}
46
- }
47
- {{end -}}
12
+ {{- $path := .Path -}}
13
+ {{- /* Range over the file's alerts */ -}}
14
+ {{- if $jdx -}},{{- end -}}
15
+ {{- range $idx, $a := .Alerts -}}
16
+
17
+ {{- $error := "" -}}
18
+ {{- if eq .Severity "error" -}}
19
+ {{- $error = "error" -}}
20
+ {{- $e = add1 $e -}}
21
+ {{- else if eq .Severity "warning " -}}
22
+ {{- $error = "warning " -}}
23
+ {{- $w = add1 $w -}}
24
+ {{- else -}}
25
+ {{- $error = "suggestion " -}}
26
+ {{- $s = add1 $s -}}
27
+ {{- end }}
28
+
29
+ {{- /* Variables setup */ -}}
30
+ {{- $loc := printf "%d" .Line - }}
31
+ {{- $check := printf "%s" .Check -}}
32
+ {{- $message := printf "%s" .Message -}}
33
+ {{- /* Only add a link for RedHat rule errors */ -}}
34
+ {{- $link := "" -}}
35
+ {{- if contains "RedHat. " .Check -}}
36
+ {{- $link = printf "For more information, see [%s](https://redhat-documentation.github.io/vale-at-red-hat/docs/main/reference-guide/%s). " .Check (lower (trimPrefix "RedHat." .Check)) -}}
37
+ {{- end -}}
38
+ {{- if $idx -}},{{- end -}}
39
+
40
+ {{- /* Output */ -}}
41
+ {
42
+ "body": "🤖 **[{{ $error }}] {{$check}}**: {{ $message }} {{ $link }}",
43
+ "path": "{{ $path }}",
44
+ "line": {{ $loc }}
45
+ }
46
+ {{end -}}
48
47
{{end -}}
49
48
]
0 commit comments