mirror of
https://github.com/golang/go
synced 2024-11-18 16:14:46 -07:00
go/analysis: suggest to users how to associate diagnostics with severities
Add to the go/analysis docs the suggestion made by Ian Cottrell that diagnostic severities should be classified by analyzer. Updates golang/go#34508 Change-Id: I9a75fb1400269ece32c9ca52afbf6c7975d3e205 Reviewed-on: https://go-review.googlesource.com/c/tools/+/230312 Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
4d5ea46c79
commit
1679474780
@ -170,6 +170,15 @@ Diagnostic is defined as:
|
||||
The optional Category field is a short identifier that classifies the
|
||||
kind of message when an analysis produces several kinds of diagnostic.
|
||||
|
||||
Many analyses want to associate diagnostics with a severity level.
|
||||
Because Diagnostic does not have a severity level field, an Analyzer's
|
||||
diagnostics effectively all have the same severity level. To separate which
|
||||
diagnostics are high severity and which are low severity, expose multiple
|
||||
Analyzers instead. Analyzers should also be separated when their
|
||||
diagnostics belong in different groups, or could be tagged differently
|
||||
before being shown to the end user. Analyzers should document their severity
|
||||
level to help downstream tools surface diagnostics properly.
|
||||
|
||||
Most Analyzers inspect typed Go syntax trees, but a few, such as asmdecl
|
||||
and buildtag, inspect the raw text of Go source files or even non-Go
|
||||
files such as assembly. To report a diagnostic against a line of a
|
||||
|
Loading…
Reference in New Issue
Block a user