From 3abfe3ffdaecddef9eccdc78fc37f6c96be64449 Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Tue, 12 Jun 2018 18:34:24 +0200 Subject: [PATCH] Replace gometalinter with golangci-lint (4.5x faster). Closes #1017 --- .golangci.yml | 73 ++++++++++++++++++++++++++++++++++++++++++++++ .gometalinter.json | 35 ---------------------- Makefile | 8 +++-- 3 files changed, 78 insertions(+), 38 deletions(-) create mode 100644 .golangci.yml delete mode 100644 .gometalinter.json diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 000000000..b995fb7c4 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,73 @@ +run: + concurrency: 4 + deadline: 1m + issues-exit-code: 1 + tests: true + # build-tags: + # - mytag + skip-dirs: + - static + skip-files: + - .*_mock.go + - jail/doc.go + +output: + format: colored-line-number + print-issued-lines: true + print-linter-name: true + +linters-settings: + errcheck: + check-type-assertions: false + check-blank: false + govet: + check-shadowing: false + golint: + min-confidence: 0.8 + gofmt: + simplify: true + gocyclo: + min-complexity: 16 + maligned: + suggest-new: true + dupl: + threshold: 50 + goconst: + min-len: 3 + min-occurrences: 2 + # depguard: + # list-type: blacklist + # include-go-root: false + # packages: + # - github.com/davecgh/go-spew/spew + +linters: + disable-all: true + enable: + - deadcode + #- depguard + - errcheck + - gas + - goconst + - gocyclo + - gofmt + - golint + - govet + - ineffassign + - interfacer + - megacheck + #- misspell + - structcheck + - unconvert + - varcheck + fast: false + +# issues: +# exclude: +# - abcdef +# exclude-use-default: true +# max-per-linter: 0 +# max-same: 0 +# new: false +# new-from-rev: "" +# new-from-patch: "" diff --git a/.gometalinter.json b/.gometalinter.json deleted file mode 100644 index 5664e4e0b..000000000 --- a/.gometalinter.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "Exclude": [ - ".*_mock.go", - "jail/doc.go", - ".*Errors unhandled.*fmt.Fprint.*gasv2.*" - ], - "Skip": ["helpers", "static"], - "Vendor": true, - "Test": true, - "Linters": { - "gasv2": { - "Command": "gas -fmt=csv", - "Pattern": "^(?P.*?\\.go),(?P\\d+),(?P[^,]+,[^,]+,[^,]+,\".*\")" - } - }, - "Enable": [ - "deadcode", - "errcheck", - "gasv2", - "goconst", - "gocyclo", - "gofmt", - "golint", - "ineffassign", - "interfacer", - "megacheck", - "misspell", - "structcheck", - "unconvert", - "varcheck", - "vet" - ], - "Cyclo": 16, - "Deadline": "200s" -} diff --git a/Makefile b/Makefile index 683879435..76caa15b2 100644 --- a/Makefile +++ b/Makefile @@ -195,12 +195,14 @@ test-e2e-race: gotest_extraflags=-race test-e2e-race: test-e2e ##@tests Run e2e tests with -race flag lint-install: - go get -u github.com/alecthomas/gometalinter - gometalinter --install + go get -u github.com/client9/misspell/cmd/misspell + @# The following installs a specific version of golangci-lint, which is appropriate for a CI server to avoid different results from build to build + curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $(GOPATH)/bin v1.6.1 lint: @echo "lint" - @gometalinter ./... + @golangci-lint run ./... + @find . -type f -not -path "./.ethereumtest/*" -not -path "./vendor/*" -not -path "./extkeys/mnemonic.go" -not -path "./extkeys/mnemonic_vectors.json" -print0 | xargs -0 misspell ci: lint mock dep-ensure test-unit test-e2e ##@tests Run all linters and tests at once