forked from docs/team-docs
ci: fix vale pipeline
This commit is contained in:
parent
fe63036346
commit
31d1f24ebb
33 changed files with 68 additions and 2436 deletions
57
vale-json.tmpl
Normal file
57
vale-json.tmpl
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
{{- /* Modify Vale's output https://docs.errata.ai/vale/cli#--output */ -}}
|
||||
|
||||
{{- /* Keep track of our various counts */ -}}
|
||||
|
||||
{{- $e := 0 -}}
|
||||
{{- $w := 0 -}}
|
||||
{{- $s := 0 -}}
|
||||
{{- $f := 0 -}}
|
||||
|
||||
{{- /* Range over the linted files */ -}}
|
||||
|
||||
[
|
||||
{{- range $jdx, $file := .Files -}}
|
||||
|
||||
{{- $f = add1 $f -}}
|
||||
{{- $path := .Path -}}
|
||||
|
||||
{{- /* Range over the file's alerts */ -}}
|
||||
|
||||
{{- if $jdx -}},{{- end -}}
|
||||
{{- range $idx, $a := .Alerts -}}
|
||||
|
||||
{{- $error := "" -}}
|
||||
{{- if eq .Severity "error" -}}
|
||||
{{- $error = "critical" -}}
|
||||
{{- $e = add1 $e -}}
|
||||
{{- else if eq .Severity "warning" -}}
|
||||
{{- $error = "major" -}}
|
||||
{{- $w = add1 $w -}}
|
||||
{{- else -}}
|
||||
{{- $error = "minor" -}}
|
||||
{{- $s = add1 $s -}}
|
||||
{{- end}}
|
||||
|
||||
{{- /* Variables setup */ -}}
|
||||
|
||||
{{- $loc := printf "%d" .Line -}}
|
||||
{{- $check := printf "%s" .Check -}}
|
||||
{{- $message := printf "%s" .Message -}}
|
||||
{{- if $idx -}},{{- end -}}
|
||||
|
||||
{{- /* Output */ -}}
|
||||
|
||||
{
|
||||
"description": "{{$check}}: {{ $message }}",
|
||||
"fingerprint": "CI_COMMIT_SHA",
|
||||
"severity": "{{ $error }}",
|
||||
"location": {
|
||||
"path": "{{ $path }}",
|
||||
"lines": {
|
||||
"begin": {{ $loc }}
|
||||
}
|
||||
}
|
||||
}
|
||||
{{end -}}
|
||||
{{end -}}
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue