Skip to content

Commit a0af020

Browse files
committed
review
1 parent 740c158 commit a0af020

File tree

4 files changed

+14
-26
lines changed

4 files changed

+14
-26
lines changed

.golangci.reference.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -403,20 +403,20 @@ linters-settings:
403403
custom-order: true
404404

405405
ginkgolinter:
406-
# Suppress the wrong length assertion warning
406+
# Suppress the wrong length assertion warning.
407407
# Default: false
408408
suppress-len-assertion: true
409409

410-
# Suppress the wrong nil assertion warning
410+
# Suppress the wrong nil assertion warning.
411411
# Default: false
412412
suppress-nil-assertion: true
413413

414-
# Suppress the wrong error assertion warning
414+
# Suppress the wrong error assertion warning.
415415
# Default: false
416416
suppress-err-assertion: true
417417

418418
gocognit:
419-
# Minimal code complexity to report
419+
# Minimal code complexity to report.
420420
# Default: 30 (but we recommend 10-20)
421421
min-complexity: 10
422422

@@ -2002,6 +2002,7 @@ linters:
20022002
- forcetypeassert
20032003
- funlen
20042004
- gci
2005+
- ginkgolinter
20052006
- gochecknoglobals
20062007
- gochecknoinits
20072008
- gocognit
@@ -2109,6 +2110,7 @@ linters:
21092110
- forcetypeassert
21102111
- funlen
21112112
- gci
2113+
- ginkgolinter
21122114
- gochecknoglobals
21132115
- gochecknoinits
21142116
- gocognit

pkg/config/linters_settings.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ var defaultLintersSettings = LintersSettings{
4040
Sections: []string{"standard", "default"},
4141
SkipGenerated: true,
4242
},
43-
GinkgoLinter: GinkgolinterSettings{
44-
SuppressLenAssertion: false,
45-
},
4643
Gocognit: GocognitSettings{
4744
MinComplexity: 30,
4845
},
@@ -153,7 +150,7 @@ type LintersSettings struct {
153150
Forbidigo ForbidigoSettings
154151
Funlen FunlenSettings
155152
Gci GciSettings
156-
GinkgoLinter GinkgolinterSettings
153+
GinkgoLinter GinkgoLinterSettings
157154
Gocognit GocognitSettings
158155
Goconst GoConstSettings
159156
Gocritic GoCriticSettings
@@ -325,7 +322,7 @@ type GciSettings struct {
325322
CustomOrder bool `mapstructure:"custom-order"`
326323
}
327324

328-
type GinkgolinterSettings struct {
325+
type GinkgoLinterSettings struct {
329326
SuppressLenAssertion bool `mapstructure:"suppress-len-assertion"`
330327
SuppressNilAssertion bool `mapstructure:"suppress-nil-assertion"`
331328
SuppressErrAssertion bool `mapstructure:"suppress-err-assertion"`

pkg/golinters/ginkgolinter.go

+5-16
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,15 @@ import (
88
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
99
)
1010

11-
func NewGinkgoLinter(cfg *config.GinkgolinterSettings) *goanalysis.Linter {
11+
func NewGinkgoLinter(cfg *config.GinkgoLinterSettings) *goanalysis.Linter {
1212
a := ginkgolinter.NewAnalyzer()
1313

1414
cfgMap := make(map[string]map[string]interface{})
1515
if cfg != nil {
16-
settings := make(map[string]interface{})
17-
if cfg.SuppressLenAssertion {
18-
settings["suppress-len-assertion"] = true
19-
}
20-
21-
if cfg.SuppressNilAssertion {
22-
settings["suppress-nil-assertion"] = true
23-
}
24-
25-
if cfg.SuppressErrAssertion {
26-
settings["suppress-err-assertion"] = true
27-
}
28-
29-
if len(settings) > 0 {
30-
cfgMap[a.Name] = settings
16+
cfgMap[a.Name] = map[string]interface{}{
17+
"suppress-len-assertion": cfg.SuppressLenAssertion,
18+
"suppress-nil-assertion": cfg.SuppressNilAssertion,
19+
"suppress-err-assertion": cfg.SuppressErrAssertion,
3120
}
3221
}
3322

pkg/lint/lintersdb/manager.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
118118
forbidigoCfg *config.ForbidigoSettings
119119
funlenCfg *config.FunlenSettings
120120
gciCfg *config.GciSettings
121-
ginkgolinterCfg *config.GinkgolinterSettings
121+
ginkgolinterCfg *config.GinkgoLinterSettings
122122
gocognitCfg *config.GocognitSettings
123123
goconstCfg *config.GoConstSettings
124124
gocriticCfg *config.GoCriticSettings

0 commit comments

Comments
 (0)