tamayika / vscode-any-lint

VSCode Any Lint allows you to lint any files with any command line tools
Other
4 stars 2 forks source link

Severity per error? #7

Closed sasq64 closed 10 months ago

sasq64 commented 10 months ago

I would like to have different severities for different errors in the same report.

tamayika commented 10 months ago

Please tell me the lint tool and how to run it and its output example. I will add a feature to support it.

sasq64 commented 10 months ago

I am writing my own linter for a language called miniscript, which we use from Unity.

Since I control the output I can adapt it to whatever any-lint wants.

I guess the best way is if format could contain ${severity}, which must match one of the severity strings as used by the configuration.

tamayika commented 10 months ago

I published 0.2.1 which supports severity placeholder and selector. If you have any trouble in new configuration, please re-open this issue.

sasq64 commented 10 months ago

I don't understand how the severityMap works. Just adding a severity like 'warning' or 'error' to the lint output and adding ${severity} doesn't seem to be enough?

sasq64 commented 10 months ago

Tried this too;

"severityMap": { "error": "error", "warning": "warning"},
"format": "${file}:${startLine}:${startColumn}:${endColumn}:${severity} ${message}"
tamayika commented 10 months ago

Yes, it is enough in your case without severityMap. However, some linter severity is not error or warning but 2 or 1 like eslint. In this case, severityMap is required to map severity to vscode-any-lint's severity.

sasq64 commented 10 months ago

But I cant get it to work with or without severityMap...

It doesnt use the severity and also doesn't parse the message.

Example output of the linter:

scripts/util.ms:26:5:6:warning Unknown function 'x'

tamayika commented 10 months ago

Please show the linter output example.

sasq64 commented 10 months ago

I did :)

From VSCode it looks like only the last word is put into message.

So I suspect in the example above, I get;

severity = "warning unknown function" message = "'x'"

sasq64 commented 10 months ago

Yes that was it. I changed the format to: "format": "${file}:${startLine}:${startColumn}:${endColumn}:${severity}:${message}" and the output accordingly, and it works (at least until there is a colon in the error message)

tamayika commented 10 months ago

Yes, string placeholder is just replaced to .* in regexp token. So, some special characters or format are necessary to match correctly.