[tools] gopls/internal/hooks: add Staticcheck's quickfix category of checks

30 views
Skip to first unread message

Rebecca Stambler (Gerrit)

unread,
May 25, 2021, 3:05:17 PM5/25/21
to Dominik Honnef, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go Bot, kokoro, golang-co...@googlegroups.com

Rebecca Stambler submitted this change.

View Change

Approvals: Rebecca Stambler: Looks good to me, approved Dominik Honnef: Trusted; Run TryBots Go Bot: TryBots succeeded kokoro: gopls CI succeeded
gopls/internal/hooks: add Staticcheck's quickfix category of checks

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 <dom...@honnef.co>
Run-TryBot: Dominik Honnef <dom...@honnef.co>
gopls-CI: kokoro <noreply...@google.com>
TryBot-Result: Go Bot <go...@golang.org>
Reviewed-by: Rebecca Stambler <rsta...@golang.org>
---
M gopls/internal/hooks/analysis.go
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/gopls/internal/hooks/analysis.go b/gopls/internal/hooks/analysis.go
index 25eed8d..f1d166b 100644
--- a/gopls/internal/hooks/analysis.go
+++ b/gopls/internal/hooks/analysis.go
@@ -11,6 +11,7 @@
"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"
@@ -55,4 +56,5 @@
"SA5011": {},
})
add(stylecheck.Analyzers, nil)
+ add(quickfix.Analyzers, nil)
}

To view, visit change 322492. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I8f5b4eca67eb6b4e45c17510459d83eb673384e3
Gerrit-Change-Number: 322492
Gerrit-PatchSet: 2
Gerrit-Owner: Dominik Honnef <dom...@honnef.co>
Gerrit-Reviewer: Dominik Honnef <dom...@honnef.co>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Rebecca Stambler <rsta...@golang.org>
Gerrit-Reviewer: kokoro <noreply...@google.com>
Gerrit-MessageType: merged
Reply all
Reply to author
Forward
0 new messages