mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 21:46:22 +01:00
add template from main
This commit is contained in:
committed by
openshift-cherrypick-robot
parent
75836a00d6
commit
48602255f2
48
.vale/templates/bot-comment-output.tmpl
Normal file
48
.vale/templates/bot-comment-output.tmpl
Normal file
@@ -0,0 +1,48 @@
|
||||
{{- /* Modify Vale's output https://docs.errata.ai/vale/cli#--output */ -}}
|
||||
|
||||
{{- /* Keep track of our various counts */ -}}
|
||||
|
||||
{{- $e := 0 -}}
|
||||
{{- $w := 0 -}}
|
||||
{{- $s := 0 -}}
|
||||
|
||||
{{- /* Range over the linted files */ -}}
|
||||
[
|
||||
{{- range $jdx, $file := .Files -}}
|
||||
{{- $path := .Path -}}
|
||||
{{- /* Range over the file's alerts */ -}}
|
||||
{{- if $jdx -}},{{- end -}}
|
||||
{{- range $idx, $a := .Alerts -}}
|
||||
|
||||
{{- $error := "" -}}
|
||||
{{- if eq .Severity "error" -}}
|
||||
{{- $error = "error" -}}
|
||||
{{- $e = add1 $e -}}
|
||||
{{- else if eq .Severity "warning" -}}
|
||||
{{- $error = "warning" -}}
|
||||
{{- $w = add1 $w -}}
|
||||
{{- else -}}
|
||||
{{- $error = "suggestion" -}}
|
||||
{{- $s = add1 $s -}}
|
||||
{{- end}}
|
||||
|
||||
{{- /* Variables setup */ -}}
|
||||
{{- $loc := printf "%d" .Line -}}
|
||||
{{- $check := printf "%s" .Check -}}
|
||||
{{- $message := printf "%s" .Message -}}
|
||||
{{- /* Only add a link for RedHat rule errors */ -}}
|
||||
{{- $link := "" -}}
|
||||
{{- if contains "RedHat." .Check -}}
|
||||
{{- $link = printf "For more information, see [%s](https://redhat-documentation.github.io/vale-at-red-hat/docs/main/reference-guide/%s)." .Check (lower (trimPrefix "RedHat." .Check)) -}}
|
||||
{{- end -}}
|
||||
{{- if $idx -}},{{- end -}}
|
||||
|
||||
{{- /* Output */ -}}
|
||||
{
|
||||
"body": "🤖 **[{{ $error }}] {{$check}}**: {{ $message }} {{ $link }}",
|
||||
"path": "{{ $path }}",
|
||||
"line": {{ $loc }}
|
||||
}
|
||||
{{end -}}
|
||||
{{end -}}
|
||||
]
|
||||
Reference in New Issue
Block a user