2018-06-02 11:36:50 +03:00
|
|
|
package lintersdb
|
2018-05-06 13:25:50 +03:00
|
|
|
|
|
|
|
import (
|
2023-08-09 13:43:07 +02:00
|
|
|
"regexp"
|
|
|
|
|
2019-03-17 22:47:29 +03:00
|
|
|
"github.com/golangci/golangci-lint/pkg/config"
|
2018-05-06 19:08:34 +03:00
|
|
|
"github.com/golangci/golangci-lint/pkg/golinters"
|
2018-06-02 11:36:50 +03:00
|
|
|
"github.com/golangci/golangci-lint/pkg/lint/linter"
|
2020-01-08 05:51:55 -05:00
|
|
|
"github.com/golangci/golangci-lint/pkg/logutils"
|
2018-05-06 13:25:50 +03:00
|
|
|
)
|
|
|
|
|
2018-09-01 11:01:17 +03:00
|
|
|
type Manager struct {
|
2023-06-16 10:00:09 +02:00
|
|
|
cfg *config.Config
|
|
|
|
log logutils.Log
|
|
|
|
|
|
|
|
nameToLCs map[string][]*linter.Config
|
|
|
|
customLinters []*linter.Config
|
2018-09-01 11:01:17 +03:00
|
|
|
}
|
|
|
|
|
2020-01-08 05:51:55 -05:00
|
|
|
func NewManager(cfg *config.Config, log logutils.Log) *Manager {
|
|
|
|
m := &Manager{cfg: cfg, log: log}
|
2023-06-16 10:00:09 +02:00
|
|
|
m.customLinters = m.getCustomLinterConfigs()
|
2023-06-13 23:44:28 +02:00
|
|
|
|
2019-09-30 16:19:41 +03:00
|
|
|
nameToLCs := make(map[string][]*linter.Config)
|
2018-09-01 11:01:17 +03:00
|
|
|
for _, lc := range m.GetAllSupportedLinterConfigs() {
|
2018-09-01 14:16:30 +03:00
|
|
|
for _, name := range lc.AllNames() {
|
2019-09-30 16:19:41 +03:00
|
|
|
nameToLCs[name] = append(nameToLCs[name], lc)
|
2018-09-01 14:16:30 +03:00
|
|
|
}
|
2018-09-01 11:01:17 +03:00
|
|
|
}
|
|
|
|
|
2019-09-30 16:19:41 +03:00
|
|
|
m.nameToLCs = nameToLCs
|
2023-06-13 23:44:28 +02:00
|
|
|
|
2018-09-01 11:01:17 +03:00
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func (Manager) AllPresets() []string {
|
2020-10-02 13:00:46 -07:00
|
|
|
return []string{
|
2021-03-16 13:33:28 +01:00
|
|
|
linter.PresetBugs,
|
|
|
|
linter.PresetComment,
|
|
|
|
linter.PresetComplexity,
|
|
|
|
linter.PresetError,
|
|
|
|
linter.PresetFormatting,
|
|
|
|
linter.PresetImport,
|
|
|
|
linter.PresetMetaLinter,
|
|
|
|
linter.PresetModule,
|
|
|
|
linter.PresetPerformance,
|
|
|
|
linter.PresetSQL,
|
|
|
|
linter.PresetStyle,
|
|
|
|
linter.PresetTest,
|
|
|
|
linter.PresetUnused,
|
2020-10-02 13:00:46 -07:00
|
|
|
}
|
2018-05-08 17:13:16 +03:00
|
|
|
}
|
|
|
|
|
2018-09-01 11:01:17 +03:00
|
|
|
func (m Manager) allPresetsSet() map[string]bool {
|
2018-05-08 17:13:16 +03:00
|
|
|
ret := map[string]bool{}
|
2018-09-01 11:01:17 +03:00
|
|
|
for _, p := range m.AllPresets() {
|
2018-05-08 17:13:16 +03:00
|
|
|
ret[p] = true
|
|
|
|
}
|
|
|
|
return ret
|
|
|
|
}
|
|
|
|
|
2019-09-30 16:19:41 +03:00
|
|
|
func (m Manager) GetLinterConfigs(name string) []*linter.Config {
|
|
|
|
return m.nameToLCs[name]
|
2018-05-06 19:08:34 +03:00
|
|
|
}
|
|
|
|
|
2019-09-09 18:07:09 +03:00
|
|
|
//nolint:funlen
|
2019-03-17 22:47:29 +03:00
|
|
|
func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
|
2022-05-23 12:39:57 +02:00
|
|
|
var (
|
2022-07-18 15:17:27 +08:00
|
|
|
asasalintCfg *config.AsasalintSettings
|
2022-05-23 12:39:57 +02:00
|
|
|
bidichkCfg *config.BiDiChkSettings
|
|
|
|
cyclopCfg *config.Cyclop
|
|
|
|
decorderCfg *config.DecorderSettings
|
|
|
|
depGuardCfg *config.DepGuardSettings
|
|
|
|
dogsledCfg *config.DogsledSettings
|
|
|
|
duplCfg *config.DuplSettings
|
2022-09-16 01:08:52 +08:00
|
|
|
dupwordCfg *config.DupWordSettings
|
2022-05-23 12:39:57 +02:00
|
|
|
errcheckCfg *config.ErrcheckSettings
|
|
|
|
errchkjsonCfg *config.ErrChkJSONSettings
|
|
|
|
errorlintCfg *config.ErrorLintSettings
|
|
|
|
exhaustiveCfg *config.ExhaustiveSettings
|
|
|
|
exhaustiveStructCfg *config.ExhaustiveStructSettings
|
|
|
|
exhaustructCfg *config.ExhaustructSettings
|
|
|
|
forbidigoCfg *config.ForbidigoSettings
|
|
|
|
funlenCfg *config.FunlenSettings
|
|
|
|
gciCfg *config.GciSettings
|
2022-12-26 23:03:07 +02:00
|
|
|
ginkgolinterCfg *config.GinkgoLinterSettings
|
2022-05-23 12:39:57 +02:00
|
|
|
gocognitCfg *config.GocognitSettings
|
|
|
|
goconstCfg *config.GoConstSettings
|
2022-08-14 18:21:32 +02:00
|
|
|
gocriticCfg *config.GoCriticSettings
|
2022-05-23 12:39:57 +02:00
|
|
|
gocycloCfg *config.GoCycloSettings
|
|
|
|
godotCfg *config.GodotSettings
|
|
|
|
godoxCfg *config.GodoxSettings
|
|
|
|
gofmtCfg *config.GoFmtSettings
|
|
|
|
gofumptCfg *config.GofumptSettings
|
|
|
|
goheaderCfg *config.GoHeaderSettings
|
|
|
|
goimportsCfg *config.GoImportsSettings
|
|
|
|
golintCfg *config.GoLintSettings
|
|
|
|
goMndCfg *config.GoMndSettings
|
|
|
|
goModDirectivesCfg *config.GoModDirectivesSettings
|
|
|
|
gomodguardCfg *config.GoModGuardSettings
|
|
|
|
gosecCfg *config.GoSecSettings
|
|
|
|
gosimpleCfg *config.StaticCheckSettings
|
2023-03-26 06:35:39 +08:00
|
|
|
gosmopolitanCfg *config.GosmopolitanSettings
|
2022-05-23 12:39:57 +02:00
|
|
|
govetCfg *config.GovetSettings
|
|
|
|
grouperCfg *config.GrouperSettings
|
|
|
|
ifshortCfg *config.IfshortSettings
|
|
|
|
importAsCfg *config.ImportAsSettings
|
2023-12-17 16:51:50 +01:00
|
|
|
inamedparamCfg *config.INamedParamSettings
|
2022-08-21 15:05:41 +03:00
|
|
|
interfaceBloatCfg *config.InterfaceBloatSettings
|
2022-05-23 12:39:57 +02:00
|
|
|
ireturnCfg *config.IreturnSettings
|
|
|
|
lllCfg *config.LllSettings
|
2022-09-07 05:23:32 +08:00
|
|
|
loggerCheckCfg *config.LoggerCheckSettings
|
2022-05-23 12:39:57 +02:00
|
|
|
maintIdxCfg *config.MaintIdxSettings
|
|
|
|
makezeroCfg *config.MakezeroSettings
|
|
|
|
malignedCfg *config.MalignedSettings
|
|
|
|
misspellCfg *config.MisspellSettings
|
2023-01-21 16:36:35 +04:00
|
|
|
musttagCfg *config.MustTagSettings
|
2022-05-23 12:39:57 +02:00
|
|
|
nakedretCfg *config.NakedretSettings
|
|
|
|
nestifCfg *config.NestifSettings
|
|
|
|
nilNilCfg *config.NilNilSettings
|
|
|
|
nlreturnCfg *config.NlreturnSettings
|
|
|
|
noLintLintCfg *config.NoLintLintSettings
|
2022-06-19 14:20:47 +02:00
|
|
|
noNamedReturnsCfg *config.NoNamedReturnsSettings
|
2022-06-12 13:43:23 +02:00
|
|
|
parallelTestCfg *config.ParallelTestSettings
|
2023-11-05 13:09:24 +01:00
|
|
|
perfSprintCfg *config.PerfSprintSettings
|
2022-05-23 12:39:57 +02:00
|
|
|
preallocCfg *config.PreallocSettings
|
|
|
|
predeclaredCfg *config.PredeclaredSettings
|
|
|
|
promlinterCfg *config.PromlinterSettings
|
2023-11-05 16:10:43 +04:00
|
|
|
protogetterCfg *config.ProtoGetterSettings
|
2022-08-23 20:19:26 +09:00
|
|
|
reassignCfg *config.ReassignSettings
|
2022-05-23 12:39:57 +02:00
|
|
|
reviveCfg *config.ReviveSettings
|
|
|
|
rowserrcheckCfg *config.RowsErrCheckSettings
|
2023-10-19 13:42:40 +03:00
|
|
|
sloglintCfg *config.SlogLintSettings
|
2024-01-02 22:24:30 -05:00
|
|
|
spancheckCfg *config.SpancheckSettings
|
2022-05-23 12:39:57 +02:00
|
|
|
staticcheckCfg *config.StaticCheckSettings
|
|
|
|
structcheckCfg *config.StructCheckSettings
|
|
|
|
stylecheckCfg *config.StaticCheckSettings
|
2023-03-26 22:35:06 +08:00
|
|
|
tagalignCfg *config.TagAlignSettings
|
2022-05-23 12:39:57 +02:00
|
|
|
tagliatelleCfg *config.TagliatelleSettings
|
|
|
|
tenvCfg *config.TenvSettings
|
2023-10-09 18:06:32 +03:00
|
|
|
testifylintCfg *config.TestifylintSettings
|
2022-05-23 12:39:57 +02:00
|
|
|
testpackageCfg *config.TestpackageSettings
|
|
|
|
thelperCfg *config.ThelperSettings
|
|
|
|
unparamCfg *config.UnparamSettings
|
2023-10-09 23:45:29 +08:00
|
|
|
unusedCfg *config.UnusedSettings
|
2022-08-03 12:13:50 +03:00
|
|
|
usestdlibvars *config.UseStdlibVarsSettings
|
2022-05-23 12:39:57 +02:00
|
|
|
varcheckCfg *config.VarCheckSettings
|
|
|
|
varnamelenCfg *config.VarnamelenSettings
|
|
|
|
whitespaceCfg *config.WhitespaceSettings
|
|
|
|
wrapcheckCfg *config.WrapcheckSettings
|
|
|
|
wslCfg *config.WSLSettings
|
|
|
|
)
|
2021-03-17 16:17:33 +01:00
|
|
|
|
2019-03-17 22:47:29 +03:00
|
|
|
if m.cfg != nil {
|
2022-07-18 15:17:27 +08:00
|
|
|
asasalintCfg = &m.cfg.LintersSettings.Asasalint
|
2021-11-06 15:24:04 +01:00
|
|
|
bidichkCfg = &m.cfg.LintersSettings.BiDiChk
|
2021-09-17 11:25:37 +03:00
|
|
|
cyclopCfg = &m.cfg.LintersSettings.Cyclop
|
2022-01-05 04:18:53 +01:00
|
|
|
decorderCfg = &m.cfg.LintersSettings.Decorder
|
2022-05-23 12:39:57 +02:00
|
|
|
depGuardCfg = &m.cfg.LintersSettings.Depguard
|
|
|
|
dogsledCfg = &m.cfg.LintersSettings.Dogsled
|
|
|
|
duplCfg = &m.cfg.LintersSettings.Dupl
|
2022-09-16 01:08:52 +08:00
|
|
|
dupwordCfg = &m.cfg.LintersSettings.DupWord
|
2022-05-23 12:39:57 +02:00
|
|
|
errcheckCfg = &m.cfg.LintersSettings.Errcheck
|
|
|
|
errchkjsonCfg = &m.cfg.LintersSettings.ErrChkJSON
|
2021-09-17 11:25:37 +03:00
|
|
|
errorlintCfg = &m.cfg.LintersSettings.ErrorLint
|
2020-05-29 19:01:46 +05:30
|
|
|
exhaustiveCfg = &m.cfg.LintersSettings.Exhaustive
|
2021-02-19 19:20:47 +01:00
|
|
|
exhaustiveStructCfg = &m.cfg.LintersSettings.ExhaustiveStruct
|
2022-04-30 13:48:16 +03:00
|
|
|
exhaustructCfg = &m.cfg.LintersSettings.Exhaustruct
|
2022-05-23 12:39:57 +02:00
|
|
|
forbidigoCfg = &m.cfg.LintersSettings.Forbidigo
|
|
|
|
funlenCfg = &m.cfg.LintersSettings.Funlen
|
2022-02-14 09:51:24 +01:00
|
|
|
gciCfg = &m.cfg.LintersSettings.Gci
|
2022-12-26 23:03:07 +02:00
|
|
|
ginkgolinterCfg = &m.cfg.LintersSettings.GinkgoLinter
|
2022-05-23 12:39:57 +02:00
|
|
|
gocognitCfg = &m.cfg.LintersSettings.Gocognit
|
|
|
|
goconstCfg = &m.cfg.LintersSettings.Goconst
|
|
|
|
gocriticCfg = &m.cfg.LintersSettings.Gocritic
|
|
|
|
gocycloCfg = &m.cfg.LintersSettings.Gocyclo
|
|
|
|
godotCfg = &m.cfg.LintersSettings.Godot
|
|
|
|
godoxCfg = &m.cfg.LintersSettings.Godox
|
|
|
|
gofmtCfg = &m.cfg.LintersSettings.Gofmt
|
|
|
|
gofumptCfg = &m.cfg.LintersSettings.Gofumpt
|
|
|
|
goheaderCfg = &m.cfg.LintersSettings.Goheader
|
|
|
|
goimportsCfg = &m.cfg.LintersSettings.Goimports
|
|
|
|
golintCfg = &m.cfg.LintersSettings.Golint
|
2022-01-19 12:46:51 +01:00
|
|
|
goMndCfg = &m.cfg.LintersSettings.Gomnd
|
2022-05-23 12:39:57 +02:00
|
|
|
goModDirectivesCfg = &m.cfg.LintersSettings.GoModDirectives
|
|
|
|
gomodguardCfg = &m.cfg.LintersSettings.Gomodguard
|
2021-04-24 23:20:12 +02:00
|
|
|
gosecCfg = &m.cfg.LintersSettings.Gosec
|
2021-04-30 22:28:50 +02:00
|
|
|
gosimpleCfg = &m.cfg.LintersSettings.Gosimple
|
2023-03-26 06:35:39 +08:00
|
|
|
gosmopolitanCfg = &m.cfg.LintersSettings.Gosmopolitan
|
2021-09-17 11:25:37 +03:00
|
|
|
govetCfg = &m.cfg.LintersSettings.Govet
|
2022-01-25 01:24:35 +01:00
|
|
|
grouperCfg = &m.cfg.LintersSettings.Grouper
|
2021-09-17 11:25:37 +03:00
|
|
|
ifshortCfg = &m.cfg.LintersSettings.Ifshort
|
|
|
|
importAsCfg = &m.cfg.LintersSettings.ImportAs
|
2023-12-17 16:51:50 +01:00
|
|
|
inamedparamCfg = &m.cfg.LintersSettings.Inamedparam
|
2022-08-21 15:05:41 +03:00
|
|
|
interfaceBloatCfg = &m.cfg.LintersSettings.InterfaceBloat
|
2021-09-17 11:25:37 +03:00
|
|
|
ireturnCfg = &m.cfg.LintersSettings.Ireturn
|
2022-05-23 12:39:57 +02:00
|
|
|
lllCfg = &m.cfg.LintersSettings.Lll
|
2022-09-07 05:23:32 +08:00
|
|
|
loggerCheckCfg = &m.cfg.LintersSettings.LoggerCheck
|
2022-01-18 21:50:52 +09:00
|
|
|
maintIdxCfg = &m.cfg.LintersSettings.MaintIdx
|
2022-05-23 12:39:57 +02:00
|
|
|
makezeroCfg = &m.cfg.LintersSettings.Makezero
|
|
|
|
malignedCfg = &m.cfg.LintersSettings.Maligned
|
|
|
|
misspellCfg = &m.cfg.LintersSettings.Misspell
|
2023-01-21 16:36:35 +04:00
|
|
|
musttagCfg = &m.cfg.LintersSettings.MustTag
|
2022-05-23 12:39:57 +02:00
|
|
|
nakedretCfg = &m.cfg.LintersSettings.Nakedret
|
|
|
|
nestifCfg = &m.cfg.LintersSettings.Nestif
|
2021-09-17 11:25:37 +03:00
|
|
|
nilNilCfg = &m.cfg.LintersSettings.NilNil
|
2021-12-28 17:01:37 +02:00
|
|
|
nlreturnCfg = &m.cfg.LintersSettings.Nlreturn
|
2022-05-23 12:39:57 +02:00
|
|
|
noLintLintCfg = &m.cfg.LintersSettings.NoLintLint
|
2022-06-19 14:20:47 +02:00
|
|
|
noNamedReturnsCfg = &m.cfg.LintersSettings.NoNamedReturns
|
2022-06-12 13:43:23 +02:00
|
|
|
parallelTestCfg = &m.cfg.LintersSettings.ParallelTest
|
2023-11-05 13:09:24 +01:00
|
|
|
perfSprintCfg = &m.cfg.LintersSettings.PerfSprint
|
|
|
|
preallocCfg = &m.cfg.LintersSettings.Prealloc
|
2021-09-17 11:25:37 +03:00
|
|
|
predeclaredCfg = &m.cfg.LintersSettings.Predeclared
|
2022-05-23 12:39:57 +02:00
|
|
|
promlinterCfg = &m.cfg.LintersSettings.Promlinter
|
2023-11-05 16:10:43 +04:00
|
|
|
protogetterCfg = &m.cfg.LintersSettings.ProtoGetter
|
2022-08-23 20:19:26 +09:00
|
|
|
reassignCfg = &m.cfg.LintersSettings.Reassign
|
2021-09-17 11:25:37 +03:00
|
|
|
reviveCfg = &m.cfg.LintersSettings.Revive
|
2022-05-23 12:39:57 +02:00
|
|
|
rowserrcheckCfg = &m.cfg.LintersSettings.RowsErrCheck
|
2023-10-19 13:42:40 +03:00
|
|
|
sloglintCfg = &m.cfg.LintersSettings.SlogLint
|
2024-01-02 22:24:30 -05:00
|
|
|
spancheckCfg = &m.cfg.LintersSettings.Spancheck
|
2021-04-30 22:28:50 +02:00
|
|
|
staticcheckCfg = &m.cfg.LintersSettings.Staticcheck
|
2022-05-23 12:39:57 +02:00
|
|
|
structcheckCfg = &m.cfg.LintersSettings.Structcheck
|
2021-04-30 22:28:50 +02:00
|
|
|
stylecheckCfg = &m.cfg.LintersSettings.Stylecheck
|
2023-03-26 22:35:06 +08:00
|
|
|
tagalignCfg = &m.cfg.LintersSettings.TagAlign
|
2021-09-17 11:25:37 +03:00
|
|
|
tagliatelleCfg = &m.cfg.LintersSettings.Tagliatelle
|
2021-09-27 02:50:47 +09:00
|
|
|
tenvCfg = &m.cfg.LintersSettings.Tenv
|
2023-10-09 18:06:32 +03:00
|
|
|
testifylintCfg = &m.cfg.LintersSettings.Testifylint
|
2021-09-17 11:25:37 +03:00
|
|
|
testpackageCfg = &m.cfg.LintersSettings.Testpackage
|
|
|
|
thelperCfg = &m.cfg.LintersSettings.Thelper
|
2022-05-23 12:39:57 +02:00
|
|
|
unparamCfg = &m.cfg.LintersSettings.Unparam
|
2023-10-09 23:45:29 +08:00
|
|
|
unusedCfg = &m.cfg.LintersSettings.Unused
|
2023-04-23 17:56:27 +02:00
|
|
|
usestdlibvars = &m.cfg.LintersSettings.UseStdlibVars
|
2022-05-23 12:39:57 +02:00
|
|
|
varcheckCfg = &m.cfg.LintersSettings.Varcheck
|
2021-10-28 00:37:13 +02:00
|
|
|
varnamelenCfg = &m.cfg.LintersSettings.Varnamelen
|
2022-05-23 12:39:57 +02:00
|
|
|
whitespaceCfg = &m.cfg.LintersSettings.Whitespace
|
2021-05-01 00:13:51 +02:00
|
|
|
wrapcheckCfg = &m.cfg.LintersSettings.Wrapcheck
|
2022-05-23 12:39:57 +02:00
|
|
|
wslCfg = &m.cfg.LintersSettings.WSL
|
2022-03-23 16:54:11 +01:00
|
|
|
|
2024-02-10 03:23:29 +02:00
|
|
|
govetCfg.Go = m.cfg.Run.Go
|
2022-06-13 09:01:05 +02:00
|
|
|
|
2024-02-10 03:23:29 +02:00
|
|
|
gocriticCfg.Go = trimGoVersion(m.cfg.Run.Go)
|
2023-04-30 15:36:15 +02:00
|
|
|
|
2024-02-10 03:23:29 +02:00
|
|
|
if gofumptCfg.LangVersion == "" {
|
2022-06-13 09:01:05 +02:00
|
|
|
gofumptCfg.LangVersion = m.cfg.Run.Go
|
|
|
|
}
|
|
|
|
|
2024-02-10 03:23:29 +02:00
|
|
|
// staticcheck related linters.
|
|
|
|
if staticcheckCfg.GoVersion == "" {
|
2023-08-09 13:43:07 +02:00
|
|
|
staticcheckCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
|
2022-06-13 09:01:05 +02:00
|
|
|
}
|
2024-02-10 03:23:29 +02:00
|
|
|
if gosimpleCfg.GoVersion == "" {
|
2023-08-09 13:43:07 +02:00
|
|
|
gosimpleCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
|
2022-06-13 09:01:05 +02:00
|
|
|
}
|
2024-02-10 03:23:29 +02:00
|
|
|
if stylecheckCfg.GoVersion != "" {
|
2023-08-09 13:43:07 +02:00
|
|
|
stylecheckCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
|
2022-06-13 09:01:05 +02:00
|
|
|
}
|
2019-03-17 22:47:29 +03:00
|
|
|
}
|
2021-03-17 16:17:33 +01:00
|
|
|
|
2019-09-30 16:19:41 +03:00
|
|
|
const megacheckName = "megacheck"
|
2021-03-17 16:17:33 +01:00
|
|
|
|
2023-06-16 10:00:09 +02:00
|
|
|
var linters []*linter.Config
|
|
|
|
linters = append(linters, m.customLinters...)
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
// The linters are sorted in the alphabetical order (case-insensitive).
|
|
|
|
// When a new linter is added the version in `WithSince(...)` must be the next minor version of golangci-lint.
|
2023-06-16 10:00:09 +02:00
|
|
|
linters = append(linters,
|
2022-07-18 15:17:27 +08:00
|
|
|
linter.NewConfig(golinters.NewAsasalint(asasalintCfg)).
|
|
|
|
WithSince("1.47.0").
|
|
|
|
WithPresets(linter.PresetBugs).
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithURL("https://github.com/alingse/asasalint"),
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewAsciicheck()).
|
|
|
|
WithSince("v1.26.0").
|
|
|
|
WithPresets(linter.PresetBugs, linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/tdakkota/asciicheck"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewBiDiChkFuncName(bidichkCfg)).
|
|
|
|
WithSince("1.43.0").
|
|
|
|
WithPresets(linter.PresetBugs).
|
|
|
|
WithURL("https://github.com/breml/bidichk"),
|
|
|
|
|
2019-05-11 00:21:15 +02:00
|
|
|
linter.NewConfig(golinters.NewBodyclose()).
|
2021-03-17 16:17:33 +01:00
|
|
|
WithSince("v1.18.0").
|
2019-09-17 08:42:16 +03:00
|
|
|
WithLoadForGoAnalysis().
|
2019-05-11 00:21:15 +02:00
|
|
|
WithPresets(linter.PresetPerformance, linter.PresetBugs).
|
2022-07-21 16:52:06 +02:00
|
|
|
WithURL("https://github.com/timakin/bodyclose"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2022-01-19 22:34:53 +09:00
|
|
|
linter.NewConfig(golinters.NewContainedCtx()).
|
|
|
|
WithSince("1.44.0").
|
2023-03-26 16:32:36 +02:00
|
|
|
WithLoadForGoAnalysis().
|
2022-01-19 22:34:53 +09:00
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/sivchari/containedctx"),
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewContextCheck()).
|
|
|
|
WithSince("v1.43.0").
|
|
|
|
WithPresets(linter.PresetBugs).
|
2020-06-09 05:21:58 +09:00
|
|
|
WithLoadForGoAnalysis().
|
2022-09-08 00:15:31 +08:00
|
|
|
WithURL("https://github.com/kkHAIKE/contextcheck"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2024-02-16 08:03:35 +09:00
|
|
|
linter.NewConfig(golinters.NewCopyLoopVar()).
|
|
|
|
WithSince("v1.57.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/karamaru-alpha/copyloopvar"),
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewCyclop(cyclopCfg)).
|
|
|
|
WithSince("v1.37.0").
|
2019-09-30 16:19:41 +03:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithPresets(linter.PresetComplexity).
|
|
|
|
WithURL("https://github.com/bkielbasa/cyclop"),
|
|
|
|
|
2022-01-05 04:18:53 +01:00
|
|
|
linter.NewConfig(golinters.NewDecorder(decorderCfg)).
|
|
|
|
WithSince("v1.44.0").
|
|
|
|
WithPresets(linter.PresetFormatting, linter.PresetStyle).
|
|
|
|
WithURL("https://gitlab.com/bosi/decorder"),
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewDeadcode()).
|
2021-03-17 16:17:33 +01:00
|
|
|
WithSince("v1.0.0").
|
2019-10-14 09:50:57 +03:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithPresets(linter.PresetUnused).
|
2022-08-21 21:37:47 +02:00
|
|
|
WithURL("https://github.com/remyoudompheng/go-misc/tree/master/deadcode").
|
|
|
|
Deprecated("The owner seems to have abandoned the linter.", "v1.49.0", "unused"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewDepguard(depGuardCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.4.0").
|
|
|
|
WithPresets(linter.PresetStyle, linter.PresetImport, linter.PresetModule).
|
|
|
|
WithURL("https://github.com/OpenPeeDeeP/depguard"),
|
2018-06-02 11:36:50 +03:00
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewDogsled(dogsledCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.19.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/alexkohler/dogsled"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewDupl(duplCfg)).
|
2021-03-17 16:17:33 +01:00
|
|
|
WithSince("v1.0.0").
|
2021-12-28 17:01:37 +02:00
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/mibk/dupl"),
|
|
|
|
|
2022-09-16 01:08:52 +08:00
|
|
|
linter.NewConfig(golinters.NewDupWord(dupwordCfg)).
|
|
|
|
WithSince("1.50.0").
|
|
|
|
WithPresets(linter.PresetComment).
|
|
|
|
WithAutoFix().
|
|
|
|
WithURL("https://github.com/Abirdcfly/dupword"),
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewDurationCheck()).
|
|
|
|
WithSince("v1.37.0").
|
|
|
|
WithPresets(linter.PresetBugs).
|
2019-09-17 08:42:16 +03:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/charithe/durationcheck"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewErrcheck(errcheckCfg)).
|
2023-06-13 23:44:28 +02:00
|
|
|
WithEnabledByDefault().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.0.0").
|
2019-09-17 08:42:16 +03:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithPresets(linter.PresetBugs, linter.PresetError).
|
|
|
|
WithURL("https://github.com/kisielk/errcheck"),
|
2021-03-17 16:17:33 +01:00
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewErrChkJSONFuncName(errchkjsonCfg)).
|
|
|
|
WithSince("1.44.0").
|
|
|
|
WithPresets(linter.PresetBugs).
|
2019-09-17 08:42:16 +03:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/breml/errchkjson"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewErrName()).
|
|
|
|
WithSince("v1.42.0").
|
2019-01-08 14:31:04 +03:00
|
|
|
WithPresets(linter.PresetStyle).
|
2019-09-30 16:19:41 +03:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/Antonboom/errname"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewErrorLint(errorlintCfg)).
|
|
|
|
WithSince("v1.32.0").
|
|
|
|
WithPresets(linter.PresetBugs, linter.PresetError).
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithURL("https://github.com/polyfloyd/go-errorlint"),
|
|
|
|
|
2022-03-29 19:31:56 +09:00
|
|
|
linter.NewConfig(golinters.NewExecInQuery()).
|
|
|
|
WithSince("v1.46.0").
|
|
|
|
WithPresets(linter.PresetSQL).
|
2022-05-12 10:09:33 +02:00
|
|
|
WithLoadForGoAnalysis().
|
2022-03-29 19:31:56 +09:00
|
|
|
WithURL("https://github.com/lufeee/execinquery"),
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewExhaustive(exhaustiveCfg)).
|
|
|
|
WithSince(" v1.28.0").
|
2018-06-02 11:36:50 +03:00
|
|
|
WithPresets(linter.PresetBugs).
|
2019-09-30 16:19:41 +03:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/nishanths/exhaustive"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewExhaustiveStruct(exhaustiveStructCfg)).
|
|
|
|
WithSince("v1.32.0").
|
|
|
|
WithPresets(linter.PresetStyle, linter.PresetTest).
|
2019-09-30 16:19:41 +03:00
|
|
|
WithLoadForGoAnalysis().
|
2022-04-30 13:48:16 +03:00
|
|
|
WithURL("https://github.com/mbilski/exhaustivestruct").
|
|
|
|
Deprecated("The owner seems to have abandoned the linter.", "v1.46.0", "exhaustruct"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewExhaustruct(exhaustructCfg)).
|
|
|
|
WithSince("v1.46.0").
|
|
|
|
WithPresets(linter.PresetStyle, linter.PresetTest).
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithURL("https://github.com/GaijinEntertainment/go-exhaustruct"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewExportLoopRef()).
|
|
|
|
WithSince("v1.28.0").
|
|
|
|
WithPresets(linter.PresetBugs).
|
2019-09-30 16:19:41 +03:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/kyoh86/exportloopref"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewForbidigo(forbidigoCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.34.0").
|
2018-06-02 11:36:50 +03:00
|
|
|
WithPresets(linter.PresetStyle).
|
2023-05-31 22:33:20 +02:00
|
|
|
// Strictly speaking,
|
|
|
|
// the additional information is only needed when forbidigoCfg.AnalyzeTypes is chosen by the user.
|
|
|
|
// But we don't know that here in all cases (sometimes config is not loaded),
|
|
|
|
// so we have to assume that it is needed to be on the safe side.
|
2023-02-27 22:51:58 +01:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/ashanbrown/forbidigo"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewForceTypeAssert()).
|
|
|
|
WithSince("v1.38.0").
|
2018-06-02 11:36:50 +03:00
|
|
|
WithPresets(linter.PresetStyle).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/gostaticanalysis/forcetypeassert"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewFunlen(funlenCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.18.0").
|
|
|
|
WithPresets(linter.PresetComplexity).
|
|
|
|
WithURL("https://github.com/ultraware/funlen"),
|
|
|
|
|
2022-02-14 09:51:24 +01:00
|
|
|
linter.NewConfig(golinters.NewGci(gciCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.30.0").
|
|
|
|
WithPresets(linter.PresetFormatting, linter.PresetImport).
|
|
|
|
WithURL("https://github.com/daixiang0/gci"),
|
|
|
|
|
2022-12-26 23:03:07 +02:00
|
|
|
linter.NewConfig(golinters.NewGinkgoLinter(ginkgolinterCfg)).
|
|
|
|
WithSince("v1.51.0").
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/nunnatsa/ginkgolinter"),
|
|
|
|
|
2023-01-21 04:54:17 -08:00
|
|
|
linter.NewConfig(golinters.NewGoCheckCompilerDirectives()).
|
|
|
|
WithSince("v1.51.0").
|
|
|
|
WithPresets(linter.PresetBugs).
|
|
|
|
WithURL("https://github.com/leighmcculloch/gocheckcompilerdirectives"),
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewGochecknoglobals()).
|
|
|
|
WithSince("v1.12.0").
|
2018-06-02 11:36:50 +03:00
|
|
|
WithPresets(linter.PresetStyle).
|
2023-01-24 08:27:42 +00:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/leighmcculloch/gochecknoglobals"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewGochecknoinits()).
|
|
|
|
WithSince("v1.12.0").
|
2023-02-02 09:08:09 +01:00
|
|
|
WithPresets(linter.PresetStyle),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2023-10-10 02:37:47 +11:00
|
|
|
linter.NewConfig(golinters.NewGoCheckSumType()).
|
|
|
|
WithSince("v1.55.0").
|
|
|
|
WithPresets(linter.PresetBugs).
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithURL("https://github.com/alecthomas/go-check-sumtype"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewGocognit(gocognitCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.20.0").
|
|
|
|
WithPresets(linter.PresetComplexity).
|
|
|
|
WithURL("https://github.com/uudashr/gocognit"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewGoconst(goconstCfg)).
|
2021-03-21 23:06:40 +01:00
|
|
|
WithSince("v1.0.0").
|
2018-06-02 11:36:50 +03:00
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/jgautheron/goconst"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2022-08-14 18:21:32 +02:00
|
|
|
linter.NewConfig(golinters.NewGoCritic(gocriticCfg, m.cfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.12.0").
|
|
|
|
WithPresets(linter.PresetStyle, linter.PresetMetaLinter).
|
2019-09-30 16:19:41 +03:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/go-critic/go-critic"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewGocyclo(gocycloCfg)).
|
2021-03-17 16:17:33 +01:00
|
|
|
WithSince("v1.0.0").
|
2018-06-02 11:36:50 +03:00
|
|
|
WithPresets(linter.PresetComplexity).
|
2021-02-28 14:31:14 +03:00
|
|
|
WithURL("https://github.com/fzipp/gocyclo"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewGodot(godotCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.25.0").
|
|
|
|
WithPresets(linter.PresetStyle, linter.PresetComment).
|
|
|
|
WithAutoFix().
|
|
|
|
WithURL("https://github.com/tetafro/godot"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewGodox(godoxCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.19.0").
|
|
|
|
WithPresets(linter.PresetStyle, linter.PresetComment).
|
|
|
|
WithURL("https://github.com/matoous/godox"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewGoerr113()).
|
2021-03-17 16:17:33 +01:00
|
|
|
WithSince("v1.26.0").
|
2021-12-28 17:01:37 +02:00
|
|
|
WithPresets(linter.PresetStyle, linter.PresetError).
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithURL("https://github.com/Djarvur/go-err113"),
|
2018-06-02 11:36:50 +03:00
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewGofmt(gofmtCfg)).
|
2021-03-17 16:17:33 +01:00
|
|
|
WithSince("v1.0.0").
|
2018-06-02 11:36:50 +03:00
|
|
|
WithPresets(linter.PresetFormatting).
|
2019-02-16 21:23:57 +03:00
|
|
|
WithAutoFix().
|
2023-02-11 16:02:32 +02:00
|
|
|
WithURL("https://pkg.go.dev/cmd/gofmt"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewGofumpt(gofumptCfg)).
|
2021-03-17 16:17:33 +01:00
|
|
|
WithSince("v1.28.0").
|
2020-06-16 12:05:28 +02:00
|
|
|
WithPresets(linter.PresetFormatting).
|
2020-08-02 15:09:50 -05:00
|
|
|
WithAutoFix().
|
2020-06-16 12:05:28 +02:00
|
|
|
WithURL("https://github.com/mvdan/gofumpt"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewGoHeader(goheaderCfg)).
|
2021-03-17 16:17:33 +01:00
|
|
|
WithSince("v1.28.0").
|
2020-07-05 02:03:37 +07:00
|
|
|
WithPresets(linter.PresetStyle).
|
2022-02-24 15:49:05 +01:00
|
|
|
WithURL("https://github.com/denis-tingaikin/go-header"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewGoimports(goimportsCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.20.0").
|
2021-03-16 13:33:28 +01:00
|
|
|
WithPresets(linter.PresetFormatting, linter.PresetImport).
|
2020-07-31 08:39:08 +08:00
|
|
|
WithAutoFix().
|
2023-02-11 16:02:32 +02:00
|
|
|
WithURL("https://pkg.go.dev/golang.org/x/tools/cmd/goimports"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewGolint(golintCfg)).
|
2021-03-17 16:17:33 +01:00
|
|
|
WithSince("v1.0.0").
|
2019-09-30 16:19:41 +03:00
|
|
|
WithLoadForGoAnalysis().
|
2019-09-17 01:44:53 -04:00
|
|
|
WithPresets(linter.PresetStyle).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/golang/lint").
|
|
|
|
Deprecated("The repository of the linter has been archived by the owner.", "v1.41.0", "revive"),
|
|
|
|
|
2022-01-19 12:46:51 +01:00
|
|
|
linter.NewConfig(golinters.NewGoMND(goMndCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.22.0").
|
2021-03-16 13:33:28 +01:00
|
|
|
WithPresets(linter.PresetStyle).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/tommy-muehle/go-mnd"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewGoModDirectives(goModDirectivesCfg)).
|
|
|
|
WithSince("v1.39.0").
|
|
|
|
WithPresets(linter.PresetStyle, linter.PresetModule).
|
|
|
|
WithURL("https://github.com/ldez/gomoddirectives"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewGomodguard(gomodguardCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.25.0").
|
|
|
|
WithPresets(linter.PresetStyle, linter.PresetImport, linter.PresetModule).
|
|
|
|
WithURL("https://github.com/ryancurrah/gomodguard"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewGoPrintfFuncName()).
|
|
|
|
WithSince("v1.23.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/jirfag/go-printf-func-name"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewGosec(gosecCfg)).
|
|
|
|
WithSince("v1.0.0").
|
|
|
|
WithLoadForGoAnalysis().
|
2018-11-05 22:29:45 +03:00
|
|
|
WithPresets(linter.PresetBugs).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/securego/gosec").
|
|
|
|
WithAlternativeNames("gas"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewGosimple(gosimpleCfg)).
|
2023-06-13 23:44:28 +02:00
|
|
|
WithEnabledByDefault().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.20.0").
|
2019-09-30 16:19:41 +03:00
|
|
|
WithLoadForGoAnalysis().
|
2018-11-07 10:31:55 +03:00
|
|
|
WithPresets(linter.PresetStyle).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithAlternativeNames(megacheckName).
|
2022-04-05 11:04:59 -04:00
|
|
|
WithURL("https://github.com/dominikh/go-tools/tree/master/simple"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2023-03-26 06:35:39 +08:00
|
|
|
linter.NewConfig(golinters.NewGosmopolitan(gosmopolitanCfg)).
|
|
|
|
WithSince("v1.53.0").
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithPresets(linter.PresetBugs).
|
|
|
|
WithURL("https://github.com/xen0n/gosmopolitan"),
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewGovet(govetCfg)).
|
2023-06-13 23:44:28 +02:00
|
|
|
WithEnabledByDefault().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.0.0").
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithPresets(linter.PresetBugs, linter.PresetMetaLinter).
|
|
|
|
WithAlternativeNames("vet", "vetshadow").
|
2023-02-11 16:02:32 +02:00
|
|
|
WithURL("https://pkg.go.dev/cmd/vet"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2022-01-25 01:24:35 +01:00
|
|
|
linter.NewConfig(golinters.NewGrouper(grouperCfg)).
|
|
|
|
WithSince("v1.44.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/leonklingele/grouper"),
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewIfshort(ifshortCfg)).
|
|
|
|
WithSince("v1.36.0").
|
2019-09-10 12:25:01 +02:00
|
|
|
WithPresets(linter.PresetStyle).
|
2022-08-01 15:22:11 +03:00
|
|
|
WithURL("https://github.com/esimonov/ifshort").
|
|
|
|
Deprecated("The repository of the linter has been deprecated by the owner.", "v1.48.0", ""),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewImportAs(importAsCfg)).
|
|
|
|
WithSince("v1.38.0").
|
2019-10-04 22:03:40 +02:00
|
|
|
WithPresets(linter.PresetStyle).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithURL("https://github.com/julz/importas"),
|
|
|
|
|
2023-12-17 16:51:50 +01:00
|
|
|
linter.NewConfig(golinters.NewINamedParam(inamedparamCfg)).
|
2023-10-13 00:12:16 +02:00
|
|
|
WithSince("v1.55.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/macabu/inamedparam"),
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewIneffassign()).
|
2023-06-13 23:44:28 +02:00
|
|
|
WithEnabledByDefault().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.0.0").
|
|
|
|
WithPresets(linter.PresetUnused).
|
|
|
|
WithURL("https://github.com/gordonklaus/ineffassign"),
|
|
|
|
|
2022-08-21 15:05:41 +03:00
|
|
|
linter.NewConfig(golinters.NewInterfaceBloat(interfaceBloatCfg)).
|
|
|
|
WithSince("v1.49.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/sashamelentyev/interfacebloat"),
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewInterfacer()).
|
|
|
|
WithSince("v1.0.0").
|
|
|
|
WithLoadForGoAnalysis().
|
2020-01-19 16:46:51 +03:00
|
|
|
WithPresets(linter.PresetStyle).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/mvdan/interfacer").
|
2022-07-21 16:52:06 +02:00
|
|
|
Deprecated("The repository of the linter has been archived by the owner.", "v1.38.0", ""),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2024-02-15 15:03:11 -08:00
|
|
|
linter.NewConfig(golinters.NewIntrange()).
|
|
|
|
WithSince("v1.57.0").
|
|
|
|
WithURL("https://github.com/ckaznocha/intrange"),
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewIreturn(ireturnCfg)).
|
|
|
|
WithSince("v1.43.0").
|
2019-11-16 11:08:43 +11:00
|
|
|
WithPresets(linter.PresetStyle).
|
2020-05-13 21:22:52 +03:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/butuzov/ireturn"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewLLL(lllCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.8.0").
|
|
|
|
WithPresets(linter.PresetStyle),
|
|
|
|
|
2022-09-07 05:23:32 +08:00
|
|
|
linter.NewConfig(golinters.NewLoggerCheck(loggerCheckCfg)).
|
2022-08-23 04:49:39 +08:00
|
|
|
WithSince("v1.49.0").
|
|
|
|
WithLoadForGoAnalysis().
|
2022-09-07 05:23:32 +08:00
|
|
|
WithPresets(linter.PresetStyle, linter.PresetBugs).
|
|
|
|
WithAlternativeNames("logrlint").
|
|
|
|
WithURL("https://github.com/timonwong/loggercheck"),
|
2022-08-23 04:49:39 +08:00
|
|
|
|
2022-01-18 21:50:52 +09:00
|
|
|
linter.NewConfig(golinters.NewMaintIdx(maintIdxCfg)).
|
|
|
|
WithSince("v1.44.0").
|
|
|
|
WithPresets(linter.PresetComplexity).
|
|
|
|
WithURL("https://github.com/yagipy/maintidx"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewMakezero(makezeroCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.34.0").
|
|
|
|
WithPresets(linter.PresetStyle, linter.PresetBugs).
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithURL("https://github.com/ashanbrown/makezero"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewMaligned(malignedCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.0.0").
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithPresets(linter.PresetPerformance).
|
|
|
|
WithURL("https://github.com/mdempsky/maligned").
|
|
|
|
Deprecated("The repository of the linter has been archived by the owner.", "v1.38.0", "govet 'fieldalignment'"),
|
|
|
|
|
2023-06-01 15:16:39 +03:00
|
|
|
linter.NewConfig(golinters.NewMirror()).
|
|
|
|
WithSince("v1.53.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithURL("https://github.com/butuzov/mirror"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewMisspell(misspellCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.8.0").
|
2021-03-16 13:33:28 +01:00
|
|
|
WithPresets(linter.PresetStyle, linter.PresetComment).
|
2020-05-18 15:49:58 +03:00
|
|
|
WithAutoFix().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/client9/misspell"),
|
|
|
|
|
2023-01-21 16:36:35 +04:00
|
|
|
linter.NewConfig(golinters.NewMustTag(musttagCfg)).
|
|
|
|
WithSince("v1.51.0").
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithPresets(linter.PresetStyle, linter.PresetBugs).
|
2023-11-13 17:01:50 +01:00
|
|
|
WithURL("https://github.com/go-simpler/musttag"),
|
2023-01-21 16:36:35 +04:00
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewNakedret(nakedretCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.19.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/alexkohler/nakedret"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewNestif(nestifCfg)).
|
2021-03-17 16:17:33 +01:00
|
|
|
WithSince("v1.25.0").
|
2020-02-02 14:58:38 +09:00
|
|
|
WithPresets(linter.PresetComplexity).
|
|
|
|
WithURL("https://github.com/nakabonne/nestif"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewNilErr()).
|
|
|
|
WithSince("v1.38.0").
|
2021-02-14 19:11:38 +01:00
|
|
|
WithLoadForGoAnalysis().
|
2020-05-29 19:01:46 +05:30
|
|
|
WithPresets(linter.PresetBugs).
|
2022-07-21 16:52:06 +02:00
|
|
|
WithURL("https://github.com/gostaticanalysis/nilerr"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewNilNil(nilNilCfg)).
|
|
|
|
WithSince("v1.43.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
2020-05-29 19:01:46 +05:30
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/Antonboom/nilnil"),
|
|
|
|
|
2021-09-18 15:29:45 +03:00
|
|
|
linter.NewConfig(golinters.NewNLReturn(nlreturnCfg)).
|
2021-03-17 16:17:33 +01:00
|
|
|
WithSince("v1.30.0").
|
2020-08-02 23:16:45 +03:00
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/ssgreg/nlreturn"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewNoctx()).
|
|
|
|
WithSince("v1.28.0").
|
2020-10-09 15:42:48 +03:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithPresets(linter.PresetPerformance, linter.PresetBugs).
|
2022-07-21 16:52:06 +02:00
|
|
|
WithURL("https://github.com/sonatard/noctx"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2022-06-19 14:20:47 +02:00
|
|
|
linter.NewConfig(golinters.NewNoNamedReturns(noNamedReturnsCfg)).
|
2022-04-17 15:41:08 +02:00
|
|
|
WithSince("v1.46.0").
|
2022-06-28 14:13:15 +02:00
|
|
|
WithLoadForGoAnalysis().
|
2022-04-17 15:41:08 +02:00
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/firefart/nonamedreturns"),
|
|
|
|
|
2022-06-30 23:36:33 +09:00
|
|
|
linter.NewConfig(golinters.NewNoSnakeCase()).
|
|
|
|
WithSince("v1.47.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
2022-08-05 19:42:47 +09:00
|
|
|
WithURL("https://github.com/sivchari/nosnakecase").
|
|
|
|
Deprecated("The repository of the linter has been deprecated by the owner.", "v1.48.1", "revive(var-naming)"),
|
2022-06-30 23:36:33 +09:00
|
|
|
|
2022-04-23 19:57:45 -04:00
|
|
|
linter.NewConfig(golinters.NewNoSprintfHostPort()).
|
|
|
|
WithSince("v1.46.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/stbenjam/no-sprintf-host-port"),
|
|
|
|
|
2022-06-12 13:43:23 +02:00
|
|
|
linter.NewConfig(golinters.NewParallelTest(parallelTestCfg)).
|
2021-03-17 16:17:33 +01:00
|
|
|
WithSince("v1.33.0").
|
2022-06-06 13:16:40 +08:00
|
|
|
WithLoadForGoAnalysis().
|
2021-03-16 13:33:28 +01:00
|
|
|
WithPresets(linter.PresetStyle, linter.PresetTest).
|
2020-11-23 06:28:38 +11:00
|
|
|
WithURL("https://github.com/kunwardeep/paralleltest"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2023-11-05 13:09:24 +01:00
|
|
|
linter.NewConfig(golinters.NewPerfSprint(perfSprintCfg)).
|
2023-10-20 12:00:04 +02:00
|
|
|
WithSince("v1.55.0").
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithPresets(linter.PresetPerformance).
|
|
|
|
WithURL("https://github.com/catenacyber/perfsprint"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewPreAlloc(preallocCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.19.0").
|
|
|
|
WithPresets(linter.PresetPerformance).
|
|
|
|
WithURL("https://github.com/alexkohler/prealloc"),
|
|
|
|
|
2021-01-07 22:28:04 +05:30
|
|
|
linter.NewConfig(golinters.NewPredeclared(predeclaredCfg)).
|
2021-03-17 16:17:33 +01:00
|
|
|
WithSince("v1.35.0").
|
2021-01-07 22:28:04 +05:30
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/nishanths/predeclared"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewPromlinter(promlinterCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.40.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/yeya24/promlinter"),
|
|
|
|
|
2023-11-05 16:10:43 +04:00
|
|
|
linter.NewConfig(golinters.NewProtoGetter(protogetterCfg)).
|
2023-10-09 19:30:50 +04:00
|
|
|
WithSince("v1.55.0").
|
|
|
|
WithPresets(linter.PresetBugs).
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithAutoFix().
|
|
|
|
WithURL("https://github.com/ghostiam/protogetter"),
|
|
|
|
|
2022-08-23 20:19:26 +09:00
|
|
|
linter.NewConfig(golinters.NewReassign(reassignCfg)).
|
|
|
|
WithSince("1.49.0").
|
|
|
|
WithPresets(linter.PresetBugs).
|
2022-09-25 17:58:16 +09:00
|
|
|
WithLoadForGoAnalysis().
|
2022-08-23 20:19:26 +09:00
|
|
|
WithURL("https://github.com/curioswitch/go-reassign"),
|
|
|
|
|
2021-02-14 07:36:37 -06:00
|
|
|
linter.NewConfig(golinters.NewRevive(reviveCfg)).
|
2021-03-17 16:17:33 +01:00
|
|
|
WithSince("v1.37.0").
|
2021-03-16 13:33:28 +01:00
|
|
|
WithPresets(linter.PresetStyle, linter.PresetMetaLinter).
|
2021-03-15 08:13:54 +01:00
|
|
|
ConsiderSlow().
|
2021-02-14 07:36:37 -06:00
|
|
|
WithURL("https://github.com/mgechev/revive"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewRowsErrCheck(rowserrcheckCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.23.0").
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithPresets(linter.PresetBugs, linter.PresetSQL).
|
2023-03-14 23:01:01 +01:00
|
|
|
WithURL("https://github.com/jingyugao/rowserrcheck"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2023-10-19 13:42:40 +03:00
|
|
|
linter.NewConfig(golinters.NewSlogLint(sloglintCfg)).
|
|
|
|
WithSince("v1.55.0").
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithPresets(linter.PresetStyle, linter.PresetFormatting).
|
|
|
|
WithURL("https://github.com/go-simpler/sloglint"),
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewScopelint()).
|
|
|
|
WithSince("v1.12.0").
|
2021-02-14 18:47:06 +01:00
|
|
|
WithPresets(linter.PresetBugs).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/kyoh86/scopelint").
|
|
|
|
Deprecated("The repository of the linter has been deprecated by the owner.", "v1.39.0", "exportloopref"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewSQLCloseCheck()).
|
|
|
|
WithSince("v1.28.0").
|
|
|
|
WithPresets(linter.PresetBugs, linter.PresetSQL).
|
2021-02-14 18:47:06 +01:00
|
|
|
WithLoadForGoAnalysis().
|
2023-02-02 15:59:45 +01:00
|
|
|
WithURL("https://github.com/ryanrolds/sqlclosecheck"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2024-01-02 22:24:30 -05:00
|
|
|
linter.NewConfig(golinters.NewSpancheck(spancheckCfg)).
|
|
|
|
WithSince("v1.56.0").
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithPresets(linter.PresetBugs).
|
|
|
|
WithURL("https://github.com/jjti/go-spancheck"),
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewStaticcheck(staticcheckCfg)).
|
2023-06-13 23:44:28 +02:00
|
|
|
WithEnabledByDefault().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.0.0").
|
2021-02-22 06:01:51 +09:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithPresets(linter.PresetBugs, linter.PresetMetaLinter).
|
|
|
|
WithAlternativeNames(megacheckName).
|
2022-04-05 11:04:59 -04:00
|
|
|
WithURL("https://staticcheck.io/"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewStructcheck(structcheckCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.0.0").
|
2021-02-26 13:08:49 -06:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithPresets(linter.PresetUnused).
|
2022-07-19 12:32:33 +02:00
|
|
|
WithURL("https://github.com/opennota/check").
|
2023-03-27 01:37:47 +02:00
|
|
|
Deprecated("The owner seems to have abandoned the linter.", "v1.49.0", "unused"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewStylecheck(stylecheckCfg)).
|
|
|
|
WithSince("v1.20.0").
|
2021-02-26 22:12:32 +01:00
|
|
|
WithLoadForGoAnalysis().
|
2021-03-30 08:56:42 -04:00
|
|
|
WithPresets(linter.PresetStyle).
|
2022-04-05 11:04:59 -04:00
|
|
|
WithURL("https://github.com/dominikh/go-tools/tree/master/stylecheck"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2023-03-26 22:35:06 +08:00
|
|
|
linter.NewConfig(golinters.NewTagAlign(tagalignCfg)).
|
|
|
|
WithSince("v1.53.0").
|
|
|
|
WithPresets(linter.PresetStyle, linter.PresetFormatting).
|
|
|
|
WithAutoFix().
|
|
|
|
WithURL("https://github.com/4meepo/tagalign"),
|
|
|
|
|
2021-04-12 17:59:50 +02:00
|
|
|
linter.NewConfig(golinters.NewTagliatelle(tagliatelleCfg)).
|
|
|
|
WithSince("v1.40.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/ldez/tagliatelle"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewTenv(tenvCfg)).
|
2021-09-16 12:47:56 +03:00
|
|
|
WithSince("v1.43.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/sivchari/tenv"),
|
|
|
|
|
2022-09-07 00:24:12 +03:00
|
|
|
linter.NewConfig(golinters.NewTestableexamples()).
|
|
|
|
WithSince("v1.50.0").
|
|
|
|
WithPresets(linter.PresetTest).
|
|
|
|
WithURL("https://github.com/maratori/testableexamples"),
|
|
|
|
|
2023-10-09 18:06:32 +03:00
|
|
|
linter.NewConfig(golinters.NewTestifylint(testifylintCfg)).
|
|
|
|
WithSince("v1.55.0").
|
|
|
|
WithPresets(linter.PresetTest, linter.PresetBugs).
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithURL("https://github.com/Antonboom/testifylint"),
|
|
|
|
|
2021-12-28 17:01:37 +02:00
|
|
|
linter.NewConfig(golinters.NewTestpackage(testpackageCfg)).
|
|
|
|
WithSince("v1.25.0").
|
|
|
|
WithPresets(linter.PresetStyle, linter.PresetTest).
|
|
|
|
WithURL("https://github.com/maratori/testpackage"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewThelper(thelperCfg)).
|
|
|
|
WithSince("v1.34.0").
|
2021-09-17 11:25:37 +03:00
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL("https://github.com/kulti/thelper"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewTparallel()).
|
|
|
|
WithSince("v1.32.0").
|
|
|
|
WithPresets(linter.PresetStyle, linter.PresetTest).
|
|
|
|
WithLoadForGoAnalysis().
|
2022-07-21 16:52:06 +02:00
|
|
|
WithURL("https://github.com/moricho/tparallel"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewTypecheck()).
|
2023-06-29 22:40:59 +02:00
|
|
|
WithInternal().
|
2023-06-13 23:44:28 +02:00
|
|
|
WithEnabledByDefault().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.3.0").
|
2021-09-27 02:50:47 +09:00
|
|
|
WithLoadForGoAnalysis().
|
2021-10-05 05:21:50 +08:00
|
|
|
WithPresets(linter.PresetBugs).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithURL(""),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewUnconvert()).
|
|
|
|
WithSince("v1.0.0").
|
2021-10-05 05:21:50 +08:00
|
|
|
WithLoadForGoAnalysis().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/mdempsky/unconvert"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewUnparam(unparamCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.9.0").
|
|
|
|
WithPresets(linter.PresetUnused).
|
|
|
|
WithLoadForGoAnalysis().
|
2022-07-19 09:12:58 +02:00
|
|
|
WithURL("https://github.com/mvdan/unparam"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2023-10-09 23:45:29 +08:00
|
|
|
linter.NewConfig(golinters.NewUnused(unusedCfg, staticcheckCfg)).
|
2023-06-13 23:44:28 +02:00
|
|
|
WithEnabledByDefault().
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.20.0").
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithPresets(linter.PresetUnused).
|
|
|
|
WithAlternativeNames(megacheckName).
|
|
|
|
ConsiderSlow().
|
|
|
|
WithChangeTypes().
|
2022-04-05 11:04:59 -04:00
|
|
|
WithURL("https://github.com/dominikh/go-tools/tree/master/unused"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2022-08-03 12:13:50 +03:00
|
|
|
linter.NewConfig(golinters.NewUseStdlibVars(usestdlibvars)).
|
|
|
|
WithSince("v1.48.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/sashamelentyev/usestdlibvars"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewVarcheck(varcheckCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.0.0").
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithPresets(linter.PresetUnused).
|
2022-08-21 21:37:47 +02:00
|
|
|
WithURL("https://github.com/opennota/check").
|
|
|
|
Deprecated("The owner seems to have abandoned the linter.", "v1.49.0", "unused"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2021-10-28 00:37:13 +02:00
|
|
|
linter.NewConfig(golinters.NewVarnamelen(varnamelenCfg)).
|
|
|
|
WithSince("v1.43.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithURL("https://github.com/blizzy78/varnamelen"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewWastedAssign()).
|
|
|
|
WithSince("v1.38.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
2021-11-26 23:25:59 +01:00
|
|
|
WithLoadForGoAnalysis().
|
2023-03-13 21:35:21 +02:00
|
|
|
WithURL("https://github.com/sanposhiho/wastedassign"),
|
2021-12-28 17:01:37 +02:00
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewWhitespace(whitespaceCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.19.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithAutoFix().
|
|
|
|
WithURL("https://github.com/ultraware/whitespace"),
|
|
|
|
|
|
|
|
linter.NewConfig(golinters.NewWrapcheck(wrapcheckCfg)).
|
|
|
|
WithSince("v1.32.0").
|
|
|
|
WithPresets(linter.PresetStyle, linter.PresetError).
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithURL("https://github.com/tomarrell/wrapcheck"),
|
|
|
|
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewWSL(wslCfg)).
|
2021-12-28 17:01:37 +02:00
|
|
|
WithSince("v1.20.0").
|
|
|
|
WithPresets(linter.PresetStyle).
|
|
|
|
WithURL("https://github.com/bombsimon/wsl"),
|
2021-04-12 17:59:50 +02:00
|
|
|
|
2023-06-16 10:00:09 +02:00
|
|
|
linter.NewConfig(golinters.NewZerologLint()).
|
|
|
|
WithSince("v1.53.0").
|
|
|
|
WithPresets(linter.PresetBugs).
|
|
|
|
WithLoadForGoAnalysis().
|
|
|
|
WithURL("https://github.com/ykadowak/zerologlint"),
|
|
|
|
|
2020-04-26 19:30:14 -07:00
|
|
|
// nolintlint must be last because it looks at the results of all the previous linters for unused nolint directives
|
2022-05-23 12:39:57 +02:00
|
|
|
linter.NewConfig(golinters.NewNoLintLint(noLintLintCfg)).
|
2021-03-17 16:17:33 +01:00
|
|
|
WithSince("v1.26.0").
|
2020-04-26 19:30:14 -07:00
|
|
|
WithPresets(linter.PresetStyle).
|
2020-05-24 00:08:14 -07:00
|
|
|
WithURL("https://github.com/golangci/golangci-lint/blob/master/pkg/golinters/nolintlint/README.md"),
|
2023-06-16 10:00:09 +02:00
|
|
|
)
|
2023-04-17 01:17:49 +09:00
|
|
|
|
2023-06-16 10:00:09 +02:00
|
|
|
return linters
|
2018-05-06 13:25:50 +03:00
|
|
|
}
|
|
|
|
|
2019-01-03 11:33:05 +01:00
|
|
|
func (m Manager) GetAllEnabledByDefaultLinters() []*linter.Config {
|
|
|
|
var ret []*linter.Config
|
2018-09-01 11:01:17 +03:00
|
|
|
for _, lc := range m.GetAllSupportedLinterConfigs() {
|
2018-05-06 13:25:50 +03:00
|
|
|
if lc.EnabledByDefault {
|
2018-05-31 23:53:01 +03:00
|
|
|
ret = append(ret, lc)
|
2018-05-06 13:25:50 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret
|
|
|
|
}
|
|
|
|
|
2019-01-03 11:33:05 +01:00
|
|
|
func linterConfigsToMap(lcs []*linter.Config) map[string]*linter.Config {
|
2018-06-02 11:36:50 +03:00
|
|
|
ret := map[string]*linter.Config{}
|
2018-05-31 23:53:01 +03:00
|
|
|
for _, lc := range lcs {
|
|
|
|
lc := lc // local copy
|
2019-01-03 11:33:05 +01:00
|
|
|
ret[lc.Name()] = lc
|
2018-05-06 13:25:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret
|
|
|
|
}
|
|
|
|
|
2019-01-03 11:33:05 +01:00
|
|
|
func (m Manager) GetAllLinterConfigsForPreset(p string) []*linter.Config {
|
|
|
|
var ret []*linter.Config
|
2018-09-01 11:01:17 +03:00
|
|
|
for _, lc := range m.GetAllSupportedLinterConfigs() {
|
2022-12-08 01:14:32 +01:00
|
|
|
if lc.IsDeprecated() {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2018-05-08 17:13:16 +03:00
|
|
|
for _, ip := range lc.InPresets {
|
|
|
|
if p == ip {
|
2018-05-31 23:53:01 +03:00
|
|
|
ret = append(ret, lc)
|
2018-05-08 17:13:16 +03:00
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret
|
|
|
|
}
|
2023-08-09 13:43:07 +02:00
|
|
|
|
|
|
|
// Trims the Go version to keep only M.m.
|
|
|
|
// Since Go 1.21 the version inside the go.mod can be a patched version (ex: 1.21.0).
|
|
|
|
// https://go.dev/doc/toolchain#versions
|
|
|
|
// This a problem with staticcheck and gocritic.
|
|
|
|
func trimGoVersion(v string) string {
|
|
|
|
if v == "" {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2024-01-14 21:22:57 +01:00
|
|
|
exp := regexp.MustCompile(`(\d\.\d+)(?:\.\d+|[a-z]+\d)`)
|
2023-08-09 13:43:07 +02:00
|
|
|
|
|
|
|
if exp.MatchString(v) {
|
|
|
|
return exp.FindStringSubmatch(v)[1]
|
|
|
|
}
|
|
|
|
|
|
|
|
return v
|
|
|
|
}
|