Skip to content

Commit

Permalink
Add the ginkgolinter linter
Browse files Browse the repository at this point in the history
The ginkgolinter checks the ginkgo assersions in go tests. See here for
additional details: https://github.com/nunnatsa/ginkgolinter
  • Loading branch information
nunnatsa committed Dec 11, 2022
1 parent b2462ed commit 2e7083f
Show file tree
Hide file tree
Showing 17 changed files with 320 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .golangci.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,19 @@ linters-settings:
# Default: false
custom-order: true

ginkgolinter:
# Suppress the wrong length assertion warning
# Default: false
suppress-len-assertion: true

# Suppress the wrong nil assertion warning
# Default: false
suppress-nil-assertion: true

# Suppress the wrong error assertion warning
# Default: false
suppress-err-assertion: true

gocognit:
# Minimal code complexity to report
# Default: 30 (but we recommend 10-20)
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ require (
github.com/nakabonne/nestif v0.3.1
github.com/nishanths/exhaustive v0.9.3
github.com/nishanths/predeclared v0.2.2
github.com/nunnatsa/ginkgolinter v0.6.0
github.com/pkg/errors v0.9.1
github.com/polyfloyd/go-errorlint v1.0.6
github.com/quasilyte/go-ruleguard/dsl v0.3.21
Expand Down
2 changes: 2 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ var defaultLintersSettings = LintersSettings{
Sections: []string{"standard", "default"},
SkipGenerated: true,
},
GinkgoLinter: GinkgolinterSettings{
SuppressLenAssertion: false,
},
Gocognit: GocognitSettings{
MinComplexity: 30,
},
Expand Down Expand Up @@ -150,6 +153,7 @@ type LintersSettings struct {
Forbidigo ForbidigoSettings
Funlen FunlenSettings
Gci GciSettings
GinkgoLinter GinkgolinterSettings
Gocognit GocognitSettings
Goconst GoConstSettings
Gocritic GoCriticSettings
Expand Down Expand Up @@ -321,6 +325,12 @@ type GciSettings struct {
CustomOrder bool `mapstructure:"custom-order"`
}

type GinkgolinterSettings struct {
SuppressLenAssertion bool `mapstructure:"suppress-len-assertion"`
SuppressNilAssertion bool `mapstructure:"suppress-nil-assertion"`
SuppressErrAssertion bool `mapstructure:"suppress-err-assertion"`
}

type GocognitSettings struct {
MinComplexity int `mapstructure:"min-complexity"`
}
Expand Down
40 changes: 40 additions & 0 deletions pkg/golinters/ginkgolinter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package golinters

import (
"github.com/nunnatsa/ginkgolinter"
"golang.org/x/tools/go/analysis"

"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)

func NewGinkgoLinter(cfg *config.GinkgolinterSettings) *goanalysis.Linter {
a := ginkgolinter.NewAnalyzer()

cfgMap := make(map[string]map[string]interface{})
if cfg != nil {
settings := make(map[string]interface{})
if cfg.SuppressLenAssertion {
settings["suppress-len-assertion"] = true
}

if cfg.SuppressNilAssertion {
settings["suppress-nil-assertion"] = true
}

if cfg.SuppressErrAssertion {
settings["suppress-err-assertion"] = true
}

if len(settings) > 0 {
cfgMap[a.Name] = settings
}
}

return goanalysis.NewLinter(
a.Name,
a.Doc,
[]*analysis.Analyzer{a},
cfgMap,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
8 changes: 8 additions & 0 deletions pkg/lint/lintersdb/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
forbidigoCfg *config.ForbidigoSettings
funlenCfg *config.FunlenSettings
gciCfg *config.GciSettings
ginkgolinterCfg *config.GinkgolinterSettings
gocognitCfg *config.GocognitSettings
goconstCfg *config.GoConstSettings
gocriticCfg *config.GoCriticSettings
Expand Down Expand Up @@ -194,6 +195,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
forbidigoCfg = &m.cfg.LintersSettings.Forbidigo
funlenCfg = &m.cfg.LintersSettings.Funlen
gciCfg = &m.cfg.LintersSettings.Gci
ginkgolinterCfg = &m.cfg.LintersSettings.GinkgoLinter
gocognitCfg = &m.cfg.LintersSettings.Gocognit
goconstCfg = &m.cfg.LintersSettings.Goconst
gocriticCfg = &m.cfg.LintersSettings.Gocritic
Expand Down Expand Up @@ -430,6 +432,12 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
WithPresets(linter.PresetFormatting, linter.PresetImport).
WithURL("https://github.com/daixiang0/gci"),

linter.NewConfig(golinters.NewGinkgoLinter(ginkgolinterCfg)).
WithSince("v1.51.0").
WithLoadForGoAnalysis().
WithPresets(linter.PresetStyle).
WithURL("https://github.com/nunnatsa/ginkgolinter"),

linter.NewConfig(golinters.NewGochecknoglobals()).
WithSince("v1.12.0").
WithPresets(linter.PresetStyle).
Expand Down
1 change: 1 addition & 0 deletions test/linters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func TestTypecheck(t *testing.T) {
func TestSourcesFromTestdataSubDir(t *testing.T) {
subDirs := []string{
"loggercheck",
"ginkgolinter",
}

for _, dir := range subDirs {
Expand Down
2 changes: 2 additions & 0 deletions test/testdata/ginkgolinter/configs/ginkgolinter_default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
linters-settings:
ginkgolinter: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters-settings:
ginkgolinter:
suppress-err-assertion: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters-settings:
ginkgolinter:
suppress-len-assertion: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters-settings:
ginkgolinter:
suppress-nil-assertion: true
51 changes: 51 additions & 0 deletions test/testdata/ginkgolinter/ginkgolinter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//golangcitest:args --disable-all -Eginkgolinter
package ginkgolinter

import (
"errors"
. "github.com/onsi/gomega"
)

func LenUsecase() {
var fakeVarUnderTest []int
Expect(fakeVarUnderTest).Should(BeEmpty()) // valid
Expect(fakeVarUnderTest).ShouldNot(HaveLen(5)) // valid

Expect(len(fakeVarUnderTest)).Should(Equal(0)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.Should\\(BeEmpty\\(\\)\\). instead"
Expect(len(fakeVarUnderTest)).ShouldNot(Equal(2)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.ShouldNot\\(HaveLen\\(2\\)\\). instead"
Expect(len(fakeVarUnderTest)).To(BeNumerically("==", 0)) // // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.To\\(BeEmpty\\(\\)\\). instead"

fakeVarUnderTest = append(fakeVarUnderTest, 3)
Expect(len(fakeVarUnderTest)).ShouldNot(Equal(0)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.ShouldNot\\(BeEmpty\\(\\)\\). instead"
Expect(len(fakeVarUnderTest)).Should(Equal(1)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.Should\\(HaveLen\\(1\\)\\). instead"
Expect(len(fakeVarUnderTest)).To(BeNumerically(">", 0)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.ToNot\\(BeEmpty\\(\\)\\). instead"
Expect(len(fakeVarUnderTest)).To(BeNumerically(">=", 1)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.ToNot\\(BeEmpty\\(\\)\\). instead"
Expect(len(fakeVarUnderTest)).To(BeNumerically("!=", 0)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.ToNot\\(BeEmpty\\(\\)\\). instead"
}

func NilUsecase() {
y := 5
x := &y
Expect(x == nil).To(Equal(true)) // want "ginkgo-linter: wrong nil assertion; consider using .Expect\\(x\\)\\.To\\(BeNil\\(\\)\\). instead"
Expect(nil == x).To(Equal(true)) // want "ginkgo-linter: wrong nil assertion; consider using .Expect\\(x\\)\\.To\\(BeNil\\(\\)\\). instead"
Expect(x != nil).To(Equal(true)) // want "ginkgo-linter: wrong nil assertion; consider using .Expect\\(x\\)\\.ToNot\\(BeNil\\(\\)\\). instead"
Expect(x == nil).To(BeTrue()) // want "ginkgo-linter: wrong nil assertion; consider using .Expect\\(x\\)\\.To\\(BeNil\\(\\)\\). instead"
Expect(x == nil).To(BeFalse()) // want "ginkgo-linter: wrong nil assertion; consider using .Expect\\(x\\)\\.ToNot\\(BeNil\\(\\)\\). instead"
}
func BooleanUsecase() {
x := true
Expect(x).To(Equal(true)) // want "ginkgo-linter: wrong boolean assertion; consider using .Expect\\(x\\)\\.To\\(BeTrue\\(\\)\\). instead"
x = false
Expect(x).To(Equal(false)) // want "ginkgo-linter: wrong boolean assertion; consider using .Expect\\(x\\)\\.To\\(BeFalse\\(\\)\\). instead"
}

func ErrorUsecase() {
err := errors.New("fake error")
funcReturnsErr := func() error { return err }

Expect(err).To(BeNil()) // want "ginkgo-linter: wrong error assertion; consider using .Expect\\(err\\)\\.ToNot\\(HaveOccurred\\(\\)\\). instead"
Expect(err == nil).To(Equal(true)) // want "ginkgo-linter: wrong error assertion; consider using .Expect\\(err\\)\\.ToNot\\(HaveOccurred\\(\\)\\). instead"
Expect(err == nil).To(BeFalse()) // want "ginkgo-linter: wrong error assertion; consider using .Expect\\(err\\)\\.To\\(HaveOccurred\\(\\)\\). instead"
Expect(err != nil).To(BeTrue()) // want "ginkgo-linter: wrong error assertion; consider using .Expect\\(err\\)\\.To\\(HaveOccurred\\(\\)\\). instead"
Expect(funcReturnsErr()).To(BeNil()) // want "ginkgo-linter: wrong error assertion; consider using .Expect\\(funcReturnsErr\\(\\)\\)\\.To\\(Succeed\\(\\)\\). instead"
}
52 changes: 52 additions & 0 deletions test/testdata/ginkgolinter/ginkgolinter_suppress_err.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//golangcitest:config_path configs/ginkgolinter_suppress_err.yml
//golangcitest:args --disable-all -Eginkgolinter
package ginkgolinter

import (
"errors"
. "github.com/onsi/gomega"
)

func LenUsecase_err() {
var fakeVarUnderTest []int
Expect(fakeVarUnderTest).Should(BeEmpty()) // valid
Expect(fakeVarUnderTest).ShouldNot(HaveLen(5)) // valid

Expect(len(fakeVarUnderTest)).Should(Equal(0)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.Should\\(BeEmpty\\(\\)\\). instead"
Expect(len(fakeVarUnderTest)).ShouldNot(Equal(2)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.ShouldNot\\(HaveLen\\(2\\)\\). instead"
Expect(len(fakeVarUnderTest)).To(BeNumerically("==", 0)) // // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.To\\(BeEmpty\\(\\)\\). instead"

fakeVarUnderTest = append(fakeVarUnderTest, 3)
Expect(len(fakeVarUnderTest)).ShouldNot(Equal(0)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.ShouldNot\\(BeEmpty\\(\\)\\). instead"
Expect(len(fakeVarUnderTest)).Should(Equal(1)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.Should\\(HaveLen\\(1\\)\\). instead"
Expect(len(fakeVarUnderTest)).To(BeNumerically(">", 0)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.ToNot\\(BeEmpty\\(\\)\\). instead"
Expect(len(fakeVarUnderTest)).To(BeNumerically(">=", 1)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.ToNot\\(BeEmpty\\(\\)\\). instead"
Expect(len(fakeVarUnderTest)).To(BeNumerically("!=", 0)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.ToNot\\(BeEmpty\\(\\)\\). instead"
}

func NilUsecase_err() {
y := 5
x := &y
Expect(x == nil).To(Equal(true)) // want "ginkgo-linter: wrong nil assertion; consider using .Expect\\(x\\)\\.To\\(BeNil\\(\\)\\). instead"
Expect(nil == x).To(Equal(true)) // want "ginkgo-linter: wrong nil assertion; consider using .Expect\\(x\\)\\.To\\(BeNil\\(\\)\\). instead"
Expect(x != nil).To(Equal(true)) // want "ginkgo-linter: wrong nil assertion; consider using .Expect\\(x\\)\\.ToNot\\(BeNil\\(\\)\\). instead"
Expect(x == nil).To(BeTrue()) // want "ginkgo-linter: wrong nil assertion; consider using .Expect\\(x\\)\\.To\\(BeNil\\(\\)\\). instead"
Expect(x == nil).To(BeFalse()) // want "ginkgo-linter: wrong nil assertion; consider using .Expect\\(x\\)\\.ToNot\\(BeNil\\(\\)\\). instead"
}
func BooleanUsecase_err() {
x := true
Expect(x).To(Equal(true)) // want "ginkgo-linter: wrong boolean assertion; consider using .Expect\\(x\\)\\.To\\(BeTrue\\(\\)\\). instead"
x = false
Expect(x).To(Equal(false)) // want "ginkgo-linter: wrong boolean assertion; consider using .Expect\\(x\\)\\.To\\(BeFalse\\(\\)\\). instead"
}

func ErrorUsecase_err() {
err := errors.New("fake error")
funcReturnsErr := func() error { return err }

Expect(err).To(BeNil())
Expect(err == nil).To(Equal(true))
Expect(err == nil).To(BeFalse())
Expect(err != nil).To(BeTrue())
Expect(funcReturnsErr()).To(BeNil())
}
52 changes: 52 additions & 0 deletions test/testdata/ginkgolinter/ginkgolinter_suppress_len.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//golangcitest:config_path configs/ginkgolinter_suppress_len.yml
//golangcitest:args --disable-all -Eginkgolinter
package ginkgolinter

import (
"errors"
. "github.com/onsi/gomega"
)

func LenUsecase_len() {
var fakeVarUnderTest []int
Expect(fakeVarUnderTest).Should(BeEmpty()) // valid
Expect(fakeVarUnderTest).ShouldNot(HaveLen(5)) // valid

Expect(len(fakeVarUnderTest)).Should(Equal(0))
Expect(len(fakeVarUnderTest)).ShouldNot(Equal(2))
Expect(len(fakeVarUnderTest)).To(BeNumerically("==", 0))

fakeVarUnderTest = append(fakeVarUnderTest, 3)
Expect(len(fakeVarUnderTest)).ShouldNot(Equal(0))
Expect(len(fakeVarUnderTest)).Should(Equal(1))
Expect(len(fakeVarUnderTest)).To(BeNumerically(">", 0))
Expect(len(fakeVarUnderTest)).To(BeNumerically(">=", 1))
Expect(len(fakeVarUnderTest)).To(BeNumerically("!=", 0))
}

func NilUsecase_len() {
y := 5
x := &y
Expect(x == nil).To(Equal(true)) // want "ginkgo-linter: wrong nil assertion; consider using .Expect\\(x\\)\\.To\\(BeNil\\(\\)\\). instead"
Expect(nil == x).To(Equal(true)) // want "ginkgo-linter: wrong nil assertion; consider using .Expect\\(x\\)\\.To\\(BeNil\\(\\)\\). instead"
Expect(x != nil).To(Equal(true)) // want "ginkgo-linter: wrong nil assertion; consider using .Expect\\(x\\)\\.ToNot\\(BeNil\\(\\)\\). instead"
Expect(x == nil).To(BeTrue()) // want "ginkgo-linter: wrong nil assertion; consider using .Expect\\(x\\)\\.To\\(BeNil\\(\\)\\). instead"
Expect(x == nil).To(BeFalse()) // want "ginkgo-linter: wrong nil assertion; consider using .Expect\\(x\\)\\.ToNot\\(BeNil\\(\\)\\). instead"
}
func BooleanUsecase_len() {
x := true
Expect(x).To(Equal(true)) // want "ginkgo-linter: wrong boolean assertion; consider using .Expect\\(x\\)\\.To\\(BeTrue\\(\\)\\). instead"
x = false
Expect(x).To(Equal(false)) // want "ginkgo-linter: wrong boolean assertion; consider using .Expect\\(x\\)\\.To\\(BeFalse\\(\\)\\). instead"
}

func ErrorUsecase_len() {
err := errors.New("fake error")
funcReturnsErr := func() error { return err }

Expect(err).To(BeNil()) // want "ginkgo-linter: wrong error assertion; consider using .Expect\\(err\\)\\.ToNot\\(HaveOccurred\\(\\)\\). instead"
Expect(err == nil).To(Equal(true)) // want "ginkgo-linter: wrong error assertion; consider using .Expect\\(err\\)\\.ToNot\\(HaveOccurred\\(\\)\\). instead"
Expect(err == nil).To(BeFalse()) // want "ginkgo-linter: wrong error assertion; consider using .Expect\\(err\\)\\.To\\(HaveOccurred\\(\\)\\). instead"
Expect(err != nil).To(BeTrue()) // want "ginkgo-linter: wrong error assertion; consider using .Expect\\(err\\)\\.To\\(HaveOccurred\\(\\)\\). instead"
Expect(funcReturnsErr()).To(BeNil()) // want "ginkgo-linter: wrong error assertion; consider using .Expect\\(funcReturnsErr\\(\\)\\)\\.To\\(Succeed\\(\\)\\). instead"
}
52 changes: 52 additions & 0 deletions test/testdata/ginkgolinter/ginkgolinter_suppress_nil.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//golangcitest:args --disable-all -Eginkgolinter
//golangcitest:config_path configs/ginkgolinter_suppress_nil.yml
package ginkgolinter

import (
"errors"
. "github.com/onsi/gomega"
)

func LenUsecase_nil() {
var fakeVarUnderTest []int
Expect(fakeVarUnderTest).Should(BeEmpty()) // valid
Expect(fakeVarUnderTest).ShouldNot(HaveLen(5)) // valid

Expect(len(fakeVarUnderTest)).Should(Equal(0)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.Should\\(BeEmpty\\(\\)\\). instead"
Expect(len(fakeVarUnderTest)).ShouldNot(Equal(2)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.ShouldNot\\(HaveLen\\(2\\)\\). instead"
Expect(len(fakeVarUnderTest)).To(BeNumerically("==", 0)) // // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.To\\(BeEmpty\\(\\)\\). instead"

fakeVarUnderTest = append(fakeVarUnderTest, 3)
Expect(len(fakeVarUnderTest)).ShouldNot(Equal(0)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.ShouldNot\\(BeEmpty\\(\\)\\). instead"
Expect(len(fakeVarUnderTest)).Should(Equal(1)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.Should\\(HaveLen\\(1\\)\\). instead"
Expect(len(fakeVarUnderTest)).To(BeNumerically(">", 0)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.ToNot\\(BeEmpty\\(\\)\\). instead"
Expect(len(fakeVarUnderTest)).To(BeNumerically(">=", 1)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.ToNot\\(BeEmpty\\(\\)\\). instead"
Expect(len(fakeVarUnderTest)).To(BeNumerically("!=", 0)) // want "ginkgo-linter: wrong length assertion; consider using .Expect\\(fakeVarUnderTest\\)\\.ToNot\\(BeEmpty\\(\\)\\). instead"
}

func NilUsecase_nil() {
y := 5
x := &y
Expect(x == nil).To(Equal(true))
Expect(nil == x).To(Equal(true))
Expect(x != nil).To(Equal(true))
Expect(x == nil).To(BeTrue())
Expect(x == nil).To(BeFalse())
}
func BooleanUsecase_nil() {
x := true
Expect(x).To(Equal(true)) // want "ginkgo-linter: wrong boolean assertion; consider using .Expect\\(x\\)\\.To\\(BeTrue\\(\\)\\). instead"
x = false
Expect(x).To(Equal(false)) // want "ginkgo-linter: wrong boolean assertion; consider using .Expect\\(x\\)\\.To\\(BeFalse\\(\\)\\). instead"
}

func ErrorUsecase_nil() {
err := errors.New("fake error")
funcReturnsErr := func() error { return err }

Expect(err).To(BeNil()) // want "ginkgo-linter: wrong error assertion; consider using .Expect\\(err\\)\\.ToNot\\(HaveOccurred\\(\\)\\). instead"
Expect(err == nil).To(Equal(true)) // want "ginkgo-linter: wrong error assertion; consider using .Expect\\(err\\)\\.ToNot\\(HaveOccurred\\(\\)\\). instead"
Expect(err == nil).To(BeFalse()) // want "ginkgo-linter: wrong error assertion; consider using .Expect\\(err\\)\\.To\\(HaveOccurred\\(\\)\\). instead"
Expect(err != nil).To(BeTrue()) // want "ginkgo-linter: wrong error assertion; consider using .Expect\\(err\\)\\.To\\(HaveOccurred\\(\\)\\). instead"
Expect(funcReturnsErr()).To(BeNil()) // want "ginkgo-linter: wrong error assertion; consider using .Expect\\(funcReturnsErr\\(\\)\\)\\.To\\(Succeed\\(\\)\\). instead"
}
12 changes: 12 additions & 0 deletions test/testdata/ginkgolinter/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module ginkgolinter

go 1.19

require github.com/onsi/gomega v1.24.1

require (
github.com/google/go-cmp v0.5.9 // indirect
golang.org/x/net v0.2.0 // indirect
golang.org/x/text v0.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 2e7083f

Please sign in to comment.