Skip to content

Add severity to vale --output=line output #350

Description

@guillaume-d

OK, I know for special needs --output=JSON and Go-template-based output-styles (see below) exist already, but maybe this output style may still be expanded.

For example currently one gets:

README.md:72:71:write-good.Weasel:'likely' is a weasel word!

More useful would be:

README.md:72:71: [warning] write-good.Weasel: 'likely' is a weasel word!

Or for better backwards-compatibility (the message is the last part and not structured => unlikely to be parsed):

README.md:72:71:write-good.Weasel: [warning] 'likely' is a weasel word!

A workaround is indeed possible using a Go template file:

{{- /* Very much like `vale --output=line`, but with the severities too! -}}
{{- /* See also https://docs.errata.ai/vale/cli#template-examples */ -}}
{{- range .Files}}
{{- $p := .Path -}}
{{- range .Alerts -}}
{{- printf "%s:%d:%d: [%s] %s: %s" $p .Line (index .Span 0) .Severity .Check .Message }}
{{end -}}
{{end}}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions