2021-11-18 22:05:49 +05:30
|
|
|
{{- /* Modify Vale's output https://docs.errata.ai/vale/cli#--output */ -}}
|
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
{{- $fileIndexes := len .Files -}}
|
|
|
|
{{- $fileIndexes = sub $fileIndexes 1 -}}
|
2021-11-18 22:05:49 +05:30
|
|
|
|
|
|
|
[
|
2023-01-13 00:05:48 +05:30
|
|
|
{{- /* 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 */}}
|
2021-11-18 22:05:49 +05:30
|
|
|
{
|
|
|
|
"description": "{{ $message }}",
|
|
|
|
"fingerprint": "{{ $path }}-{{ $loc }}",
|
|
|
|
"severity": "{{ $error }}",
|
|
|
|
"location": {
|
|
|
|
"path": "{{ $path }}",
|
|
|
|
"lines": {
|
|
|
|
"begin": {{ $loc }}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-13 00:05:48 +05:30
|
|
|
{{- end}}{{- if (lt $idx1 $fileIndexes) -}},{{- end -}}
|
|
|
|
{{- end}}
|
2021-11-18 22:05:49 +05:30
|
|
|
]
|