Skip to content

Commit

Permalink
gopls/internal/hooks: add Staticcheck's quickfix category of checks
Browse files Browse the repository at this point in the history
Staticcheck's new quickfix category contains optional code
refactorings, such as turning a chain of if/else-if into a switch
statement, or simplifying boolean expressions.

These checks produce diagnostics with the "hint" or "information"
severities. Most use "hint", which produces a subtle hint in VSCode's
UI that a refactoring is available. "information" produces a blue
underline and is only used for those checks that have a very high
likelyhood of improving code readability.

Change-Id: I8f5b4eca67eb6b4e45c17510459d83eb673384e3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/322492
Trust: Dominik Honnef <dominik@honnef.co>
Run-TryBot: Dominik Honnef <dominik@honnef.co>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
  • Loading branch information
dominikh authored and stamblerre committed May 25, 2021
1 parent 917abfb commit c3e30ff
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gopls/internal/hooks/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"golang.org/x/tools/internal/lsp/protocol"
"golang.org/x/tools/internal/lsp/source"
"honnef.co/go/tools/analysis/lint"
"honnef.co/go/tools/quickfix"
"honnef.co/go/tools/simple"
"honnef.co/go/tools/staticcheck"
"honnef.co/go/tools/stylecheck"
Expand Down Expand Up @@ -55,4 +56,5 @@ func updateAnalyzers(options *source.Options) {
"SA5011": {},
})
add(stylecheck.Analyzers, nil)
add(quickfix.Analyzers, nil)
}

0 comments on commit c3e30ff

Please sign in to comment.