From b5bdf6e5219b3b57107aee49ba7c103affb65dd9 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 8 Nov 2022 15:09:34 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- doc/.vale/vale-json.tmpl | 65 +++++++++++++++++------------------------------- 1 file changed, 23 insertions(+), 42 deletions(-) (limited to 'doc/.vale') diff --git a/doc/.vale/vale-json.tmpl b/doc/.vale/vale-json.tmpl index f76ca03964c..7969cb704a0 100644 --- a/doc/.vale/vale-json.tmpl +++ b/doc/.vale/vale-json.tmpl @@ -1,47 +1,28 @@ {{- /* Modify Vale's output https://docs.errata.ai/vale/cli#--output */ -}} -{{- /* Keep track of our various counts */ -}} +{{- $fileIndexes := len .Files -}} +{{- $fileIndexes = sub $fileIndexes 1 -}} -{{- $e := 0 -}} -{{- $w := 0 -}} -{{- $s := 0 -}} -{{- $f := 0 -}} - -{{- /* Range over the linted files */ -}} - -{{- range .Files}} - -{{- $f = add1 $f -}} -{{- $path := .Path -}} - -{{- /* Range over the file's alerts */ -}} [ - -{{- range $idx, $a := .Alerts -}} - -{{- $error := "" -}} -{{- if eq .Severity "error" -}} - {{- $error = "blocker" -}} - {{- $e = add1 $e -}} -{{- else if eq .Severity "warning" -}} - {{- $error = "major" -}} - {{- $w = add1 $w -}} -{{- else -}} - {{- $error ="info" -}} - {{- $s = add1 $s -}} -{{- end}} - -{{- /* Variables setup */ -}} - -{{- $path = $path -}} -{{- $loc := printf "%d" .Line -}} -{{- $check := printf "%s" .Check -}} -{{- $message := printf "%s" .Message -}} -{{- $link := printf "%s" .Link -}} -{{- if $idx -}},{{- end -}} - -{{- /* Output */ -}} - + {{- /* 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 }}", @@ -53,6 +34,6 @@ } } } -{{end -}} -{{end -}} + {{- end}}{{- if (lt $idx1 $fileIndexes) -}},{{- end -}} + {{- end}} ] -- cgit v1.2.3