Skip to content

:sparkles, minor: Switch gometalinter.v2 with golangci-lint #393

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

Closed
wants to merge 3 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ go_import_path: sigs.k8s.io/controller-runtime
install:
- go get -u github.com/golang/dep/cmd/dep
#- go get -u golang.org/x/lint/golint
- go get -u gopkg.in/alecthomas/gometalinter.v2 && gometalinter.v2 --install
- go get -u github.com/golangci/golangci-lint/cmd/golangci-lint

script:
- TRACE=1 ./hack/check-everything.sh
Expand Down
2 changes: 1 addition & 1 deletion hack/check-everything.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function fetch_kb_tools {

header_text "using tools"

which gometalinter.v2
which golangci-lint
which dep
fetch_kb_tools
setup_envs
Expand Down
26 changes: 21 additions & 5 deletions hack/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,32 @@ go vet ./...
#
#golint -set_exit_status ./pkg/...

header_text "running gometalinter.v2"
header_text "creating config"
echo "
linters-settings:
linters-settings:
dupl:
threshold: 400
min-len: 3
lll:
line-length: 170
tab-width: 1
issues:
exclude-rules:
- path: _test\.go
linters:
- errcheck"> /tmp/.golangci-lint-config.yml

gometalinter.v2 --disable-all \
header_text "running golangci-lint"

golangci-lint run --disable-all \
--config /tmp/.golangci-lint-config.yml \
--deadline 5m \
--enable=misspell \
--enable=structcheck \
--enable=golint \
--enable=deadcode \
--enable=goimports \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dupe of L68?

--enable=errcheck \
--enable=varcheck \
--enable=goconst \
Expand All @@ -44,11 +62,9 @@ gometalinter.v2 --disable-all \
--enable=interfacer \
--enable=misspell \
--enable=gocyclo \
--line-length=170 \
--enable=lll \
--dupl-threshold=400 \
--enable=dupl \
--skip=atomic \
--skip-dirs=atomic \
--enable=goimports \
./pkg/... ./examples/... .
# TODO: Enable these as we fix them to make them pass
Expand Down
2 changes: 1 addition & 1 deletion pkg/source/source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ var _ = Describe("Source", func() {
if eventCount == 0 {
<-unblock
}
eventCount += 1
eventCount++

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this change should be apart of this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lint check was failing because of eventCount += 1. I figured it would break the CI if I did not make the minor change. Thoughts on how to handle it?


if eventCount == 3 {
close(processed)
Expand Down