build(deps): bump github.com/go-critic/go-critic from 0.6.4 to 0.6.5 (#3150)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
parent
7e769dab90
commit
28d7095413
12
go.mod
12
go.mod
@ -28,7 +28,7 @@ require (
|
||||
github.com/fatih/color v1.13.0
|
||||
github.com/firefart/nonamedreturns v1.0.4
|
||||
github.com/fzipp/gocyclo v0.6.0
|
||||
github.com/go-critic/go-critic v0.6.4
|
||||
github.com/go-critic/go-critic v0.6.5
|
||||
github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b
|
||||
github.com/gofrs/flock v0.8.1
|
||||
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2
|
||||
@ -124,8 +124,8 @@ require (
|
||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/go-toolsmith/astcast v1.0.0 // indirect
|
||||
github.com/go-toolsmith/astcopy v1.0.1 // indirect
|
||||
github.com/go-toolsmith/astequal v1.0.2 // indirect
|
||||
github.com/go-toolsmith/astcopy v1.0.2 // indirect
|
||||
github.com/go-toolsmith/astequal v1.0.3 // indirect
|
||||
github.com/go-toolsmith/astfmt v1.0.0 // indirect
|
||||
github.com/go-toolsmith/astp v1.0.0 // indirect
|
||||
github.com/go-toolsmith/strparse v1.0.0 // indirect
|
||||
@ -156,8 +156,8 @@ require (
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.32.1 // indirect
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
github.com/quasilyte/go-ruleguard v0.3.17 // indirect
|
||||
github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5 // indirect
|
||||
github.com/quasilyte/go-ruleguard v0.3.18 // indirect
|
||||
github.com/quasilyte/gogrep v0.0.0-20220828223005-86e4605de09f // indirect
|
||||
github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect
|
||||
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
|
||||
github.com/sivchari/nosnakecase v1.7.0
|
||||
@ -174,7 +174,7 @@ require (
|
||||
go.uber.org/multierr v1.6.0 // indirect
|
||||
go.uber.org/zap v1.17.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
|
||||
golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d // indirect
|
||||
golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91 // indirect
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
|
||||
|
27
go.sum
generated
27
go.sum
generated
@ -102,7 +102,7 @@ github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnht
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/cristalhq/acmd v0.7.0/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ=
|
||||
github.com/cristalhq/acmd v0.8.1/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ=
|
||||
github.com/curioswitch/go-reassign v0.1.2 h1:ekM07+z+VFT560Exz4mTv0/s1yU9gem6CJc/tlYpkmI=
|
||||
github.com/curioswitch/go-reassign v0.1.2/go.mod h1:bFJIHgtTM3hRm2sKXSPkbwNjSFyGURQXyn4IXD2qwfQ=
|
||||
github.com/daixiang0/gci v0.6.3 h1:wUAqXChk8HbwXn8AfxD9DYSCp9Bpz1L3e6Q4Roe+q9E=
|
||||
@ -133,8 +133,8 @@ github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwV
|
||||
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
|
||||
github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo=
|
||||
github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA=
|
||||
github.com/go-critic/go-critic v0.6.4 h1:tucuG1pvOyYgpBIrVxw0R6gwO42lNa92Aq3VaDoIs+E=
|
||||
github.com/go-critic/go-critic v0.6.4/go.mod h1:qL5SOlk7NtY6sJPoVCTKDIgzNOxHkkkOCVDyi9wJe1U=
|
||||
github.com/go-critic/go-critic v0.6.5 h1:fDaR/5GWURljXwF8Eh31T2GZNz9X4jeboS912mWF8Uo=
|
||||
github.com/go-critic/go-critic v0.6.5/go.mod h1:ezfP/Lh7MA6dBNn4c6ab5ALv3sKnZVLx37tr00uuaOY=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
@ -150,13 +150,12 @@ github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/go-toolsmith/astcast v1.0.0 h1:JojxlmI6STnFVG9yOImLeGREv8W2ocNUM+iOhR6jE7g=
|
||||
github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4=
|
||||
github.com/go-toolsmith/astcopy v1.0.0/go.mod h1:vrgyG+5Bxrnz4MZWPF+pI4R8h3qKRjjyvV/DSez4WVQ=
|
||||
github.com/go-toolsmith/astcopy v1.0.1 h1:l09oBhAPyV74kLJ3ZO31iBU8htZGTwr9LTjuMCyL8go=
|
||||
github.com/go-toolsmith/astcopy v1.0.1/go.mod h1:4TcEdbElGc9twQEYpVo/aieIXfHhiuLh4aLAck6dO7Y=
|
||||
github.com/go-toolsmith/astcopy v1.0.2 h1:YnWf5Rnh1hUudj11kei53kI57quN/VH6Hp1n+erozn0=
|
||||
github.com/go-toolsmith/astcopy v1.0.2/go.mod h1:4TcEdbElGc9twQEYpVo/aieIXfHhiuLh4aLAck6dO7Y=
|
||||
github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY=
|
||||
github.com/go-toolsmith/astequal v1.0.1/go.mod h1:4oGA3EZXTVItV/ipGiOx7NWkY5veFfcsOJVS2YxltLw=
|
||||
github.com/go-toolsmith/astequal v1.0.2 h1:+XvaV8zNxua+9+Oa4AHmgmpo4RYAbwr/qjNppLfX2yM=
|
||||
github.com/go-toolsmith/astequal v1.0.2/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4=
|
||||
github.com/go-toolsmith/astequal v1.0.3 h1:+LVdyRatFS+XO78SGV4I3TCEA0AC7fKEGma+fH+674o=
|
||||
github.com/go-toolsmith/astequal v1.0.3/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4=
|
||||
github.com/go-toolsmith/astfmt v1.0.0 h1:A0vDDXt+vsvLEdbMFJAUBI/uTbRw1ffOPnxsILnFL6k=
|
||||
github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw=
|
||||
github.com/go-toolsmith/astp v1.0.0 h1:alXE75TXgcmupDsMK1fRAy0YUzLzqPVvBKoyWV+KPXg=
|
||||
@ -439,15 +438,15 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1
|
||||
github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=
|
||||
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||
github.com/quasilyte/go-ruleguard v0.3.1-0.20210203134552-1b5a410e1cc8/go.mod h1:KsAh3x0e7Fkpgs+Q9pNLS5XpFSvYCEVl5gP9Pp1xp30=
|
||||
github.com/quasilyte/go-ruleguard v0.3.17 h1:cDdoaSbQg11LXPDQqiCK54QmQXsEQQCTIgdcpeULGSI=
|
||||
github.com/quasilyte/go-ruleguard v0.3.17/go.mod h1:sST5PvaR7yb/Az5ksX8oc88usJ4EGjmJv7cK7y3jyig=
|
||||
github.com/quasilyte/go-ruleguard v0.3.18 h1:sd+abO1PEI9fkYennwzHn9kl3nqP6M5vE7FiOzZ+5CE=
|
||||
github.com/quasilyte/go-ruleguard v0.3.18/go.mod h1:lOIzcYlgxrQ2sGJ735EHXmf/e9MJ516j16K/Ifcttvs=
|
||||
github.com/quasilyte/go-ruleguard/dsl v0.3.0/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU=
|
||||
github.com/quasilyte/go-ruleguard/dsl v0.3.21 h1:vNkC6fC6qMLzCOGbnIHOd5ixUGgTbp3Z4fGnUgULlDA=
|
||||
github.com/quasilyte/go-ruleguard/dsl v0.3.21/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU=
|
||||
github.com/quasilyte/go-ruleguard/rules v0.0.0-20201231183845-9e62ed36efe1/go.mod h1:7JTjp89EGyU1d6XfBiXihJNG37wB2VRkd125Q1u7Plc=
|
||||
github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50=
|
||||
github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5 h1:PDWGei+Rf2bBiuZIbZmM20J2ftEy9IeUCHA8HbQqed8=
|
||||
github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5/go.mod h1:wSEyW6O61xRV6zb6My3HxrQ5/8ke7NE2OayqCHa3xRM=
|
||||
github.com/quasilyte/gogrep v0.0.0-20220828223005-86e4605de09f h1:6Gtn2i04RD0gVyYf2/IUMTIs+qYleBt4zxDqkLTcu4U=
|
||||
github.com/quasilyte/gogrep v0.0.0-20220828223005-86e4605de09f/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng=
|
||||
github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 h1:L8QM9bvf68pVdQ3bCFZMDmnt9yqcMBro1pC7F+IPYMY=
|
||||
github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0=
|
||||
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs=
|
||||
@ -604,8 +603,8 @@ golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMk
|
||||
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
|
||||
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA=
|
||||
golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
|
||||
golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d h1:+W8Qf4iJtMGKkyAygcKohjxTk4JPsL9DpzApJ22m5Ic=
|
||||
golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
|
||||
golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91 h1:Ic/qN6TEifvObMGQy72k0n1LlJr7DjWWEi+MOsDOiSk=
|
||||
golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
|
@ -25,11 +25,9 @@ import (
|
||||
|
||||
const goCriticName = "gocritic"
|
||||
|
||||
const goCriticDebugKey = "gocritic"
|
||||
|
||||
var (
|
||||
goCriticDebugf = logutils.Debug(goCriticDebugKey)
|
||||
isGoCriticDebug = logutils.HaveDebugTag(goCriticDebugKey)
|
||||
goCriticDebugf = logutils.Debug(goCriticName)
|
||||
isGoCriticDebug = logutils.HaveDebugTag(goCriticName)
|
||||
)
|
||||
|
||||
func NewGoCritic(settings *config.GoCriticSettings, cfg *config.Config) *goanalysis.Linter {
|
||||
@ -37,9 +35,8 @@ func NewGoCritic(settings *config.GoCriticSettings, cfg *config.Config) *goanaly
|
||||
var resIssues []goanalysis.Issue
|
||||
|
||||
wrapper := &goCriticWrapper{
|
||||
settings: settings,
|
||||
cfg: cfg,
|
||||
sizes: types.SizesFor("gc", runtime.GOARCH),
|
||||
cfg: cfg,
|
||||
sizes: types.SizesFor("gc", runtime.GOARCH),
|
||||
}
|
||||
|
||||
analyzer := &analysis.Analyzer{
|
||||
@ -72,7 +69,7 @@ Dynamic rules are written declaratively with AST patterns, filters, report messa
|
||||
nil,
|
||||
).
|
||||
WithContextSetter(func(context *linter.Context) {
|
||||
wrapper.init()
|
||||
wrapper.init(settings, context.Log)
|
||||
}).
|
||||
WithIssuesReporter(func(*linter.Context) []goanalysis.Issue {
|
||||
return resIssues
|
||||
@ -80,33 +77,33 @@ Dynamic rules are written declaratively with AST patterns, filters, report messa
|
||||
}
|
||||
|
||||
type goCriticWrapper struct {
|
||||
settings *config.GoCriticSettings
|
||||
settingsWrapper *goCriticSettingsWrapper
|
||||
cfg *config.Config
|
||||
sizes types.Sizes
|
||||
once sync.Once
|
||||
}
|
||||
|
||||
func (w *goCriticWrapper) init() {
|
||||
if w.settings != nil {
|
||||
// the 'defer' is here to catch the panic from checkers.InitEmbeddedRules()
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
linterLogger.Fatalf("%s: %v: setting an explicit GOROOT can fix this problem.", goCriticName, err)
|
||||
return
|
||||
}
|
||||
}()
|
||||
w.once.Do(checkers.InitEmbeddedRules)
|
||||
|
||||
settingsWrapper := newGoCriticSettingsWrapper(w.settings)
|
||||
|
||||
settingsWrapper.inferEnabledChecks(linterLogger)
|
||||
if err := settingsWrapper.validate(linterLogger); err != nil {
|
||||
linterLogger.Fatalf("%s: invalid settings: %s", goCriticName, err)
|
||||
}
|
||||
|
||||
w.settingsWrapper = settingsWrapper
|
||||
func (w *goCriticWrapper) init(settings *config.GoCriticSettings, logger logutils.Log) {
|
||||
if settings == nil {
|
||||
return
|
||||
}
|
||||
|
||||
w.once.Do(func() {
|
||||
err := checkers.InitEmbeddedRules()
|
||||
if err != nil {
|
||||
logger.Fatalf("%s: %v: setting an explicit GOROOT can fix this problem.", goCriticName, err)
|
||||
}
|
||||
})
|
||||
|
||||
settingsWrapper := newGoCriticSettingsWrapper(settings, logger)
|
||||
|
||||
settingsWrapper.inferEnabledChecks()
|
||||
|
||||
if err := settingsWrapper.validate(); err != nil {
|
||||
logger.Fatalf("%s: invalid settings: %s", goCriticName, err)
|
||||
}
|
||||
|
||||
w.settingsWrapper = settingsWrapper
|
||||
}
|
||||
|
||||
func (w *goCriticWrapper) run(pass *analysis.Pass) ([]goanalysis.Issue, error) {
|
||||
@ -268,13 +265,15 @@ func (w *goCriticWrapper) normalizeCheckerParamsValue(p interface{}) interface{}
|
||||
type goCriticSettingsWrapper struct {
|
||||
*config.GoCriticSettings
|
||||
|
||||
logger logutils.Log
|
||||
|
||||
allCheckers []*gocriticlinter.CheckerInfo
|
||||
allCheckerMap map[string]*gocriticlinter.CheckerInfo
|
||||
|
||||
inferredEnabledChecks map[string]bool
|
||||
}
|
||||
|
||||
func newGoCriticSettingsWrapper(settings *config.GoCriticSettings) *goCriticSettingsWrapper {
|
||||
func newGoCriticSettingsWrapper(settings *config.GoCriticSettings, logger logutils.Log) *goCriticSettingsWrapper {
|
||||
allCheckers := gocriticlinter.GetCheckersInfo()
|
||||
|
||||
allCheckerMap := make(map[string]*gocriticlinter.CheckerInfo)
|
||||
@ -284,6 +283,7 @@ func newGoCriticSettingsWrapper(settings *config.GoCriticSettings) *goCriticSett
|
||||
|
||||
return &goCriticSettingsWrapper{
|
||||
GoCriticSettings: settings,
|
||||
logger: logger,
|
||||
allCheckers: allCheckers,
|
||||
allCheckerMap: allCheckerMap,
|
||||
inferredEnabledChecks: map[string]bool{},
|
||||
@ -343,7 +343,7 @@ func (s *goCriticSettingsWrapper) disabledCheckersDebugf() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *goCriticSettingsWrapper) inferEnabledChecks(log logutils.Log) {
|
||||
func (s *goCriticSettingsWrapper) inferEnabledChecks() {
|
||||
s.checkerTagsDebugf()
|
||||
|
||||
enabledByDefaultChecks := s.getDefaultEnabledCheckersNames()
|
||||
@ -371,7 +371,7 @@ func (s *goCriticSettingsWrapper) inferEnabledChecks(log logutils.Log) {
|
||||
|
||||
// DisabledTags
|
||||
if len(s.DisabledTags) != 0 {
|
||||
enabledChecks = s.filterByDisableTags(enabledChecks, s.DisabledTags, log)
|
||||
enabledChecks = s.filterByDisableTags(enabledChecks, s.DisabledTags)
|
||||
}
|
||||
|
||||
// EnabledChecks
|
||||
@ -381,7 +381,7 @@ func (s *goCriticSettingsWrapper) inferEnabledChecks(log logutils.Log) {
|
||||
alreadyEnabledChecksSet := stringsSliceToSet(enabledChecks)
|
||||
for _, enabledCheck := range s.EnabledChecks {
|
||||
if alreadyEnabledChecksSet[enabledCheck] {
|
||||
log.Warnf("No need to enable check %q: it's already enabled", enabledCheck)
|
||||
s.logger.Warnf("%s: no need to enable check %q: it's already enabled", goCriticName, enabledCheck)
|
||||
continue
|
||||
}
|
||||
enabledChecks = append(enabledChecks, enabledCheck)
|
||||
@ -395,8 +395,8 @@ func (s *goCriticSettingsWrapper) inferEnabledChecks(log logutils.Log) {
|
||||
enabledChecksSet := stringsSliceToSet(enabledChecks)
|
||||
for _, disabledCheck := range s.DisabledChecks {
|
||||
if !enabledChecksSet[disabledCheck] {
|
||||
log.Warnf("Gocritic check %q was explicitly disabled via config. However, as this check "+
|
||||
"is disabled by default, there is no need to explicitly disable it via config.", disabledCheck)
|
||||
s.logger.Warnf("%s: check %q was explicitly disabled via config. However, as this check "+
|
||||
"is disabled by default, there is no need to explicitly disable it via config.", goCriticName, disabledCheck)
|
||||
continue
|
||||
}
|
||||
delete(enabledChecksSet, disabledCheck)
|
||||
@ -418,7 +418,7 @@ func (s *goCriticSettingsWrapper) inferEnabledChecks(log logutils.Log) {
|
||||
s.disabledCheckersDebugf()
|
||||
}
|
||||
|
||||
func (s *goCriticSettingsWrapper) validate(log logutils.Log) error {
|
||||
func (s *goCriticSettingsWrapper) validate() error {
|
||||
if len(s.EnabledTags) == 0 {
|
||||
if len(s.EnabledChecks) != 0 && len(s.DisabledChecks) != 0 {
|
||||
return errors.New("both enabled and disabled check aren't allowed for gocritic")
|
||||
@ -454,7 +454,7 @@ func (s *goCriticSettingsWrapper) validate(log logutils.Log) error {
|
||||
return errors.Wrap(err, "validate disabled checks")
|
||||
}
|
||||
|
||||
if err := s.validateCheckerNames(log); err != nil {
|
||||
if err := s.validateCheckerNames(); err != nil {
|
||||
return errors.Wrap(err, "validation failed")
|
||||
}
|
||||
|
||||
@ -502,7 +502,7 @@ func (s *goCriticSettingsWrapper) getDefaultDisabledCheckersNames() []string {
|
||||
return disabled
|
||||
}
|
||||
|
||||
func (s *goCriticSettingsWrapper) validateCheckerNames(log logutils.Log) error {
|
||||
func (s *goCriticSettingsWrapper) validateCheckerNames() error {
|
||||
allowedNames := s.getAllCheckerNames()
|
||||
|
||||
for _, name := range s.EnabledChecks {
|
||||
@ -526,7 +526,7 @@ func (s *goCriticSettingsWrapper) validateCheckerNames(log logutils.Log) error {
|
||||
}
|
||||
|
||||
if !s.isCheckEnabled(checkName) {
|
||||
log.Warnf("%s: settings were provided for not enabled check %q", goCriticName, checkName)
|
||||
s.logger.Warnf("%s: settings were provided for not enabled check %q", goCriticName, checkName)
|
||||
}
|
||||
}
|
||||
|
||||
@ -543,13 +543,13 @@ func (s *goCriticSettingsWrapper) getLowerCasedParams() map[string]config.GoCrit
|
||||
return ret
|
||||
}
|
||||
|
||||
func (s *goCriticSettingsWrapper) filterByDisableTags(enabledChecks, disableTags []string, log logutils.Log) []string {
|
||||
func (s *goCriticSettingsWrapper) filterByDisableTags(enabledChecks, disableTags []string) []string {
|
||||
enabledChecksSet := stringsSliceToSet(enabledChecks)
|
||||
|
||||
for _, enabledCheck := range enabledChecks {
|
||||
checkInfo, checkInfoExists := s.allCheckerMap[enabledCheck]
|
||||
if !checkInfoExists {
|
||||
log.Warnf("%s: check %q was not exists via filtering disabled tags", goCriticName, enabledCheck)
|
||||
s.logger.Warnf("%s: check %q was not exists via filtering disabled tags", goCriticName, enabledCheck)
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,9 @@ func Test_filterByDisableTags(t *testing.T) {
|
||||
disabledTags := []string{"experimental", "opinionated"}
|
||||
enabledChecks := []string{"appendAssign", "sortSlice", "caseOrder", "dupImport"}
|
||||
|
||||
settingsWrapper := newGoCriticSettingsWrapper(nil)
|
||||
settingsWrapper := newGoCriticSettingsWrapper(nil, &tLog{})
|
||||
|
||||
filterEnabledChecks := settingsWrapper.filterByDisableTags(enabledChecks, disabledTags, &tLog{})
|
||||
filterEnabledChecks := settingsWrapper.filterByDisableTags(enabledChecks, disabledTags)
|
||||
|
||||
sort.Strings(filterEnabledChecks)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user