diff --git a/.golangci.next.reference.yml b/.golangci.next.reference.yml index 632605787381..9898baa717fc 100644 --- a/.golangci.next.reference.yml +++ b/.golangci.next.reference.yml @@ -626,6 +626,10 @@ linters: # Default: false force-succeed: true + # Force adding assertion descriptions to gomega matchers. + # Default: false + force-assertion-description: true + gochecksumtype: # Presence of `default` case in switch statements satisfies exhaustiveness, if all members are not listed. # Default: true diff --git a/go.mod b/go.mod index ed0f8eae1280..051a038fd51b 100644 --- a/go.mod +++ b/go.mod @@ -88,7 +88,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.19.1 + github.com/nunnatsa/ginkgolinter v0.20.0 github.com/pelletier/go-toml/v2 v2.2.4 github.com/polyfloyd/go-errorlint v1.8.0 github.com/quasilyte/go-ruleguard/dsl v0.3.22 @@ -213,7 +213,7 @@ require ( go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac // indirect + golang.org/x/exp/typeparams v0.0.0-20250620022241-b7579e27df2b // indirect golang.org/x/text v0.26.0 // indirect google.golang.org/protobuf v1.36.6 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index a71063445c1f..ce2d16fec73d 100644 --- a/go.sum +++ b/go.sum @@ -438,8 +438,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.19.1 h1:mjwbOlDQxZi9Cal+KfbEJTCz327OLNfwNvoZ70NJ+c4= -github.com/nunnatsa/ginkgolinter v0.19.1/go.mod h1:jkQ3naZDmxaZMXPWaS9rblH+i+GWXQCaS/JFIWcOH2s= +github.com/nunnatsa/ginkgolinter v0.20.0 h1:OmWLkAFO2HUTYcU6mprnKud1Ey5pVdiVNYGO5HVicx8= +github.com/nunnatsa/ginkgolinter v0.20.0/go.mod h1:dCIuFlTPfQerXgGUju3VygfAFPdC5aE1mdacCDKDJcQ= github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus= github.com/onsi/ginkgo/v2 v2.23.4/go.mod h1:Bt66ApGPBFzHyR+JO10Zbt0Gsp4uWxu5mIOTusL46e8= github.com/onsi/gomega v1.37.0 h1:CdEG8g0S133B4OswTDC/5XPSzE1OeP29QOioj2PID2Y= @@ -669,8 +669,8 @@ golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWB golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac h1:TSSpLIG4v+p0rPv1pNOQtl1I8knsO4S9trOxNMOLVP4= -golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20250620022241-b7579e27df2b h1:KdrhdYPDUvJTvrDK9gdjfFd6JTk8vA1WJoldYSi0kHo= +golang.org/x/exp/typeparams v0.0.0-20250620022241-b7579e27df2b/go.mod h1:LKZHyeOpPuZcMgxeHjJp4p5yvxrCX1xDvH10zYHhjjQ= 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= diff --git a/jsonschema/golangci.next.jsonschema.json b/jsonschema/golangci.next.jsonschema.json index 3e51264fec47..23ed5a0cbbd9 100644 --- a/jsonschema/golangci.next.jsonschema.json +++ b/jsonschema/golangci.next.jsonschema.json @@ -1509,6 +1509,11 @@ "description": "Force using the Succeed matcher for error functions, and the HaveOccurred matcher for non-function error values.", "type": "boolean", "default": false + }, + "force-assertion-description": { + "description": "Force adding assertion descriptions to gomega matchers.", + "type": "boolean", + "default": false } } }, diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index 67d4bf518336..67514662089f 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -466,6 +466,7 @@ type GinkgoLinterSettings struct { ValidateAsyncIntervals bool `mapstructure:"validate-async-intervals"` ForbidSpecPollution bool `mapstructure:"forbid-spec-pollution"` ForceSucceedForFuncs bool `mapstructure:"force-succeed"` + ForceAssertionDescription bool `mapstructure:"force-assertion-description"` } type GoChecksumTypeSettings struct { diff --git a/pkg/golinters/ginkgolinter/ginkgolinter.go b/pkg/golinters/ginkgolinter/ginkgolinter.go index 519e968e5d8b..71bb2409cef0 100644 --- a/pkg/golinters/ginkgolinter/ginkgolinter.go +++ b/pkg/golinters/ginkgolinter/ginkgolinter.go @@ -2,29 +2,30 @@ package ginkgolinter import ( "github.com/nunnatsa/ginkgolinter" - "github.com/nunnatsa/ginkgolinter/types" + glconfig "github.com/nunnatsa/ginkgolinter/config" "github.com/golangci/golangci-lint/v2/pkg/config" "github.com/golangci/golangci-lint/v2/pkg/goanalysis" ) func New(settings *config.GinkgoLinterSettings) *goanalysis.Linter { - cfg := &types.Config{} + cfg := &glconfig.Config{} if settings != nil { - cfg = &types.Config{ - SuppressLen: settings.SuppressLenAssertion, - SuppressNil: settings.SuppressNilAssertion, - SuppressErr: settings.SuppressErrAssertion, - SuppressCompare: settings.SuppressCompareAssertion, - SuppressAsync: settings.SuppressAsyncAssertion, - ForbidFocus: settings.ForbidFocusContainer, - SuppressTypeCompare: settings.SuppressTypeCompareWarning, - AllowHaveLen0: settings.AllowHaveLenZero, - ForceExpectTo: settings.ForceExpectTo, - ValidateAsyncIntervals: settings.ValidateAsyncIntervals, - ForbidSpecPollution: settings.ForbidSpecPollution, - ForceSucceedForFuncs: settings.ForceSucceedForFuncs, + cfg = &glconfig.Config{ + SuppressLen: settings.SuppressLenAssertion, + SuppressNil: settings.SuppressNilAssertion, + SuppressErr: settings.SuppressErrAssertion, + SuppressCompare: settings.SuppressCompareAssertion, + SuppressAsync: settings.SuppressAsyncAssertion, + ForbidFocus: settings.ForbidFocusContainer, + SuppressTypeCompare: settings.SuppressTypeCompareWarning, + AllowHaveLen0: settings.AllowHaveLenZero, + ForceExpectTo: settings.ForceExpectTo, + ValidateAsyncIntervals: settings.ValidateAsyncIntervals, + ForbidSpecPollution: settings.ForbidSpecPollution, + ForceSucceedForFuncs: settings.ForceSucceedForFuncs, + ForceAssertionDescription: settings.ForceAssertionDescription, } }