39 lines
1 KiB
Cheetah
39 lines
1 KiB
Cheetah
{{- /* Modify Vale's output https://docs.errata.ai/vale/cli#--output */ -}}
|
|
|
|
{{- $fileIndexes := len .Files -}}
|
|
{{- $fileIndexes = sub $fileIndexes 1 -}}
|
|
|
|
[
|
|
{{- /* Range over the linted files */ -}}
|
|
{{- range $idx1, $a := .Files -}}
|
|
{{- $path := .Path -}}
|
|
|
|
{{/* Range over the file's alerts */}}
|
|
{{- range $idx2, $b := .Alerts -}}
|
|
{{- $error := "info" -}}
|
|
{{- if eq .Severity "error" -}}
|
|
{{- $error = "blocker" -}}
|
|
{{- else if eq .Severity "warning" -}}
|
|
{{- $error = "major" -}}
|
|
{{- end}}
|
|
|
|
{{- /* Variables setup */ -}}
|
|
{{- $loc := printf "%d" .Line -}}
|
|
{{- $message := printf "%s" .Message -}}
|
|
{{- if $idx2 -}},{{- end -}}
|
|
|
|
{{/* Output */}}
|
|
{
|
|
"description": "{{ $message }}",
|
|
"fingerprint": "{{ $path }}-{{ $loc }}",
|
|
"severity": "{{ $error }}",
|
|
"location": {
|
|
"path": "{{ $path }}",
|
|
"lines": {
|
|
"begin": {{ $loc }}
|
|
}
|
|
}
|
|
}
|
|
{{- end}}{{- if (lt $idx1 $fileIndexes) -}},{{- end -}}
|
|
{{- end}}
|
|
]
|