reviewdog / errorformat

Vim's quickfix errorformat implementation in Go
https://reviewdog.github.io/errorformat-playground/
MIT License
109 stars 43 forks source link

SARIF: parse and populate ruleId #142

Open alexeagle opened 8 months ago

alexeagle commented 8 months ago

I run a linter that produces a report file containing

docs/platform/training/index.md:32:73:Google.We:Try to avoid using first-person plural like 'we'.

The Google:We is the identifier for which lint rule was violated.

The underlying quickfix implementation in vim only supports:

        %n              error number (finds a number)
        %m              error message (finds a string)

but many tools produce an error code like that which is alphanumeric and can't be parsed with %n.

In the SARIF output I'd like to use ruleId to capture this field, so the message doesn't get the code jammed in it.

https://github.com/microsoft/sarif-tutorials/blob/main/docs/3-Beyond-basics.md#related-locations shows a sample of how this may be reported.

alexeagle commented 8 months ago

As another way to describe the issue, https://github.com/reviewdog/errorformat/blob/master/fmts/testdata/ansible-lint.ok has [E201] Trailing whitespace as the message, but I think E201 should have been parseable as a code and the message only read Trailing whitespace