Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ginkgolinter linter #3369

Merged
merged 1 commit into from
Dec 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .golangci.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,21 @@ 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
# Minimal code complexity to report.
# Default: 30 (but we recommend 10-20)
min-complexity: 10

Expand Down Expand Up @@ -1989,6 +2002,7 @@ linters:
- forcetypeassert
- funlen
- gci
- ginkgolinter
- gochecknoglobals
- gochecknoinits
- gocognit
Expand Down Expand Up @@ -2096,6 +2110,7 @@ linters:
- forcetypeassert
- funlen
- gci
- ginkgolinter
- gochecknoglobals
- gochecknoinits
- gocognit
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.

7 changes: 7 additions & 0 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ type LintersSettings struct {
Forbidigo ForbidigoSettings
Funlen FunlenSettings
Gci GciSettings
GinkgoLinter GinkgoLinterSettings
Gocognit GocognitSettings
Goconst GoConstSettings
Gocritic GoCriticSettings
Expand Down Expand Up @@ -321,6 +322,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
29 changes: 29 additions & 0 deletions pkg/golinters/ginkgolinter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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 {
cfgMap[a.Name] = map[string]interface{}{
"suppress-len-assertion": cfg.SuppressLenAssertion,
"suppress-nil-assertion": cfg.SuppressNilAssertion,
"suppress-err-assertion": cfg.SuppressErrAssertion,
}
}

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