@@ -2,36 +2,38 @@ package golinters
22
33import (
44 "github.com/nunnatsa/ginkgolinter"
5+ "github.com/nunnatsa/ginkgolinter/types"
56 "golang.org/x/tools/go/analysis"
67
78 "github.com/golangci/golangci-lint/pkg/config"
89 "github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
910)
1011
1112func NewGinkgoLinter (settings * config.GinkgoLinterSettings ) * goanalysis.Linter {
12- a := ginkgolinter . NewAnalyzer ()
13+ cfg := & types. Config {}
1314
14- cfgMap := make (map [string ]map [string ]any )
1515 if settings != nil {
16- cfgMap [ a . Name ] = map [ string ] any {
17- "suppress-len-assertion" : settings .SuppressLenAssertion ,
18- "suppress-nil-assertion" : settings .SuppressNilAssertion ,
19- "suppress-err-assertion" : settings .SuppressErrAssertion ,
20- "suppress-compare-assertion" : settings .SuppressCompareAssertion ,
21- "suppress-async-assertion" : settings .SuppressAsyncAssertion ,
22- "suppress-type-compare-assertion" : settings .SuppressTypeCompareWarning ,
23- "forbid-focus-container" : settings .ForbidFocusContainer ,
24- "allow-havelen-0" : settings .AllowHaveLenZero ,
25- "force-expect-to" : settings .ForceExpectTo ,
26- "forbid-spec-pollution" : settings .ForbidSpecPollution ,
27- "validate-async-intervals" : settings .ValidateAsyncIntervals ,
16+ cfg = & types. Config {
17+ SuppressLen : types . Boolean ( settings .SuppressLenAssertion ) ,
18+ SuppressNil : types . Boolean ( settings .SuppressNilAssertion ) ,
19+ SuppressErr : types . Boolean ( settings .SuppressErrAssertion ) ,
20+ SuppressCompare : types . Boolean ( settings .SuppressCompareAssertion ) ,
21+ SuppressAsync : types . Boolean ( settings .SuppressAsyncAssertion ) ,
22+ ForbidFocus : types . Boolean ( settings .ForbidFocusContainer ) ,
23+ SuppressTypeCompare : types . Boolean ( settings .SuppressTypeCompareWarning ) ,
24+ AllowHaveLen0 : types . Boolean ( settings .AllowHaveLenZero ) ,
25+ ForceExpectTo : types . Boolean ( settings .ForceExpectTo ) ,
26+ ValidateAsyncIntervals : types . Boolean ( settings .ForbidSpecPollution ) ,
27+ ForbidSpecPollution : types . Boolean ( settings .ValidateAsyncIntervals ) ,
2828 }
2929 }
3030
31+ a := ginkgolinter .NewAnalyzerWithConfig (cfg )
32+
3133 return goanalysis .NewLinter (
3234 a .Name ,
3335 "enforces standards of using ginkgo and gomega" ,
3436 []* analysis.Analyzer {a },
35- cfgMap ,
37+ nil ,
3638 ).WithLoadMode (goanalysis .LoadModeTypesInfo )
3739}
0 commit comments