Skip to content

Commit 74f0f79

Browse files
authored
Merge pull request #73831 from aireilly/update-template
Tweaking Vale template to add links
2 parents f739980 + 1365898 commit 74f0f79

File tree

1 file changed

+35
-36
lines changed

1 file changed

+35
-36
lines changed

.vale/templates/bot-comment-output.tmpl

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,42 @@
77
{{- $s := 0 -}}
88

99
{{- /* Range over the linted files */ -}}
10-
1110
[
1211
{{- 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 -}}
4847
{{end -}}
4948
]

0 commit comments

Comments
 (0)