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

Switch from golint to staticcheck #457

Merged
merged 16 commits into from
Feb 15, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ jobs:
${{ runner.os }}-go-cache
- name: Run gofmt
run: gofmt -d -e . 2>&1 | tee outfile && test -z "$(cat outfile)" && rm outfile
- name: Run golint
- name: Run staticcheck
carleeto marked this conversation as resolved.
Show resolved Hide resolved
if: matrix.go-version == '1.17.x'
run: |
go install golang.org/x/lint/golint@latest
golint -set_exit_status ./...
cd _examples && golint -set_exit_status ./... && cd ..
bin/staticcheck_linux_amd64_2021.1.2 github.com/cucumber/godog
bin/staticcheck_linux_amd64_2021.1.2 github.com/cucumber/godog/cmd/godog
# Disable for now because of failing checks
# TODO: Add back in when fixes are made
# bin/staticcheck_linux_amd64_2021.1.2 ./...
- name: Run go vet
run: |
go vet ./...
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ If everything passes, you're ready to hack!
[install go]: https://golang.org/doc/install
[community Slack]: https://cucumber.io/community#slack
[raise an issue]: https://github.com/cucumber/godog/issues/new/choose

## Changing dependencies

If dependencies have changed, you will also need to update the _examples module. `go mod tidy` should be sufficient.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ test: check-go-version
@echo "running all tests"
@go install ./...
@go fmt ./...
@go run golang.org/x/lint/golint@latest github.com/cucumber/godog
@go run golang.org/x/lint/golint@latest github.com/cucumber/godog/cmd/godog
@go run honnef.co/go/tools/cmd/staticcheck@v0.2.2 github.com/cucumber/godog
@go run honnef.co/go/tools/cmd/staticcheck@v0.2.2 github.com/cucumber/godog/cmd/godog
go vet ./...
go test -race ./...
godog -f progress -c 4
Expand Down
Binary file added bin/staticcheck_linux_amd64_2021.1.2
Binary file not shown.
3 changes: 1 addition & 2 deletions run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,8 +632,7 @@ type progressOutput struct {
bottomRows []string
}

func passingStepDef() error { return nil }
func passingStepDefWithoutReturn() {}
func passingStepDef() error { return nil }

func oddEvenStepDef(odd, even int) error { return oddOrEven(odd, even) }

Expand Down
10 changes: 0 additions & 10 deletions suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,16 +418,6 @@ func (s *suite) shouldFail(err error) bool {
return true
}

func isEmptyFeature(pickles []*messages.Pickle) bool {
for _, pickle := range pickles {
if len(pickle.Steps) > 0 {
return false
}
}

return true
}

func (s *suite) runPickle(pickle *messages.Pickle) (err error) {
ctx := s.defaultContext
if ctx == nil {
Expand Down
4 changes: 2 additions & 2 deletions test_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ func TestScenarioContext_Step(t *testing.T) {
})

Convey("has more than 2 return values", func() {
So(func() { ctx.Step(".*", nokLimitCase) }, ShouldPanicWith, fmt.Sprintf("expected handler to return either zero, one or two values, but it has: 3"))
So(func() { ctx.Step(".*", nokMore) }, ShouldPanicWith, fmt.Sprintf("expected handler to return either zero, one or two values, but it has: 5"))
So(func() { ctx.Step(".*", nokLimitCase) }, ShouldPanicWith, "expected handler to return either zero, one or two values, but it has: 3")
So(func() { ctx.Step(".*", nokMore) }, ShouldPanicWith, "expected handler to return either zero, one or two values, but it has: 5")
})

Convey("return type is not an error or string slice or void", func() {
Expand Down