diff --git a/go.mod b/go.mod index 8049596d..60c087d9 100644 --- a/go.mod +++ b/go.mod @@ -79,7 +79,7 @@ require ( github.com/nakabonne/nestif v0.3.1 github.com/nishanths/exhaustive v0.12.0 github.com/nishanths/predeclared v0.2.2 - github.com/nunnatsa/ginkgolinter v0.16.0 + github.com/nunnatsa/ginkgolinter v0.16.1 github.com/polyfloyd/go-errorlint v1.4.8 github.com/quasilyte/go-ruleguard/dsl v0.3.22 github.com/ryancurrah/gomodguard v1.3.0 diff --git a/go.sum b/go.sum index 95fe0a9f..448a5afd 100644 --- a/go.sum +++ b/go.sum @@ -393,8 +393,8 @@ github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhK github.com/nishanths/exhaustive v0.12.0/go.mod h1:mEZ95wPIZW+x8kC4TgC+9YCUgiST7ecevsVDTgc2obs= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.16.0 h1:typ0xsoXQTD4O7+uMQCsXRIzADdwROr5CcKVoOY1wd4= -github.com/nunnatsa/ginkgolinter v0.16.0/go.mod h1:4tWRinDN1FeJgU+iJANW/kz7xKN5nYRAOfJDQUS9dOQ= +github.com/nunnatsa/ginkgolinter v0.16.1 h1:uDIPSxgVHZ7PgbJElRDGzymkXH+JaF7mjew+Thjnt6Q= +github.com/nunnatsa/ginkgolinter v0.16.1/go.mod h1:4tWRinDN1FeJgU+iJANW/kz7xKN5nYRAOfJDQUS9dOQ= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= diff --git a/pkg/golinters/ginkgolinter.go b/pkg/golinters/ginkgolinter.go index af58c7c3..3d20a9f4 100644 --- a/pkg/golinters/ginkgolinter.go +++ b/pkg/golinters/ginkgolinter.go @@ -2,6 +2,7 @@ package golinters import ( "github.com/nunnatsa/ginkgolinter" + "github.com/nunnatsa/ginkgolinter/types" "golang.org/x/tools/go/analysis" "github.com/golangci/golangci-lint/pkg/config" @@ -9,29 +10,30 @@ import ( ) func NewGinkgoLinter(settings *config.GinkgoLinterSettings) *goanalysis.Linter { - a := ginkgolinter.NewAnalyzer() + cfg := &types.Config{} - cfgMap := make(map[string]map[string]any) if settings != nil { - cfgMap[a.Name] = map[string]any{ - "suppress-len-assertion": settings.SuppressLenAssertion, - "suppress-nil-assertion": settings.SuppressNilAssertion, - "suppress-err-assertion": settings.SuppressErrAssertion, - "suppress-compare-assertion": settings.SuppressCompareAssertion, - "suppress-async-assertion": settings.SuppressAsyncAssertion, - "suppress-type-compare-assertion": settings.SuppressTypeCompareWarning, - "forbid-focus-container": settings.ForbidFocusContainer, - "allow-havelen-0": settings.AllowHaveLenZero, - "force-expect-to": settings.ForceExpectTo, - "forbid-spec-pollution": settings.ForbidSpecPollution, - "validate-async-intervals": settings.ValidateAsyncIntervals, + cfg = &types.Config{ + SuppressLen: types.Boolean(settings.SuppressLenAssertion), + SuppressNil: types.Boolean(settings.SuppressNilAssertion), + SuppressErr: types.Boolean(settings.SuppressErrAssertion), + SuppressCompare: types.Boolean(settings.SuppressCompareAssertion), + SuppressAsync: types.Boolean(settings.SuppressAsyncAssertion), + ForbidFocus: types.Boolean(settings.ForbidFocusContainer), + SuppressTypeCompare: types.Boolean(settings.SuppressTypeCompareWarning), + AllowHaveLen0: types.Boolean(settings.AllowHaveLenZero), + ForceExpectTo: types.Boolean(settings.ForceExpectTo), + ValidateAsyncIntervals: types.Boolean(settings.ForbidSpecPollution), + ForbidSpecPollution: types.Boolean(settings.ValidateAsyncIntervals), } } + a := ginkgolinter.NewAnalyzerWithConfig(cfg) + return goanalysis.NewLinter( a.Name, "enforces standards of using ginkgo and gomega", []*analysis.Analyzer{a}, - cfgMap, + nil, ).WithLoadMode(goanalysis.LoadModeTypesInfo) }