Skip to content

How to set the severity for custom linters. #4917

Answered by ldez
kitimark asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

Your configuration works as expected:

$ ./bin/golangci-lint run --out-format json | jq  '.Issues[] | {linter: .FromLinter, text: .Text, severity: .Severity }'
{
  "linter": "nilaway",
  "text": "\u001b[31merror: \u001b[0mPotential nil panic detected. Observed nil flow from source to dereference point: \n\t- sandbox/foo.go:29:9: unassigned variable \u001b[95m`v`\u001b[0m dereferenced\n",
  "severity": "info"
}

As you can see nilway reports are using info as severity.

The beginning of the message (\u001b[31merror: \u001b[0m) is coming from nilway itself.

https://github.com/uber-go/nilaway/blob/8ff8105b59f17f02e8c2eb1e4dfafbcff3b23873/util/util.go#L441-L453

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kitimark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants