File tree 1 file changed +49
-0
lines changed
1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ {{- /* Modify Vale's output https://docs.errata.ai/vale/cli#--output */ -}}
2
+
3
+ {{- /* Keep track of our various counts */ -}}
4
+
5
+ {{- $e := 0 -}}
6
+ {{- $w := 0 -}}
7
+ {{- $s := 0 -}}
8
+
9
+ {{- /* Range over the linted files */ -}}
10
+
11
+ [
12
+ {{- 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 -}}
48
+ {{end -}}
49
+ ]
You can’t perform that action at this time.
0 commit comments