Skip to content

Commit

Permalink
switch to golangci-linter instead of metalinter
Browse files Browse the repository at this point in the history
 - do we need to add all those deps to go.sum, too?
  • Loading branch information
liamsi committed Mar 6, 2019
1 parent 859d01d commit 41350f1
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 41 deletions.
59 changes: 59 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
run:
deadline: 1m

linters:
enable-all: true
disable:
- gocyclo
- golint
- maligned
- errcheck
- staticcheck
- dupl
- ineffassign
- interfacer
- unconvert
- goconst
- unparam
- nakedret
- lll
- gochecknoglobals
- gocritic
- gochecknoinits
- scopelint
- stylecheck

# linters-settings:
# govet:
# check-shadowing: true
# golint:
# min-confidence: 0
# gocyclo:
# min-complexity: 10
# maligned:
# suggest-new: true
# dupl:
# threshold: 100
# goconst:
# min-len: 2
# min-occurrences: 2
# depguard:
# list-type: blacklist
# packages:
# # logging is allowed only by logutils.Log, logrus
# # is allowed to use only in logutils package
# - github.com/sirupsen/logrus
# misspell:
# locale: US
# lll:
# line-length: 140
# goimports:
# local-prefixes: github.com/golangci/golangci-lint
# gocritic:
# enabled-tags:
# - performance
# - style
# - experimental
# disabled-checks:
# - wrapperFunc
# - commentFormatting # https://github.com/go-critic/go-critic/issues/755
48 changes: 7 additions & 41 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GOTOOLS = \
gopkg.in/alecthomas/gometalinter.v2
github.com/golangci/golangci-lint/cmd/golangci-lint
GOTOOLS_CHECK = gometalinter.v2

all: check_tools test metalinter
Expand Down Expand Up @@ -36,7 +36,7 @@ update_tools:
### Testing

test:
go test $(shell go list ./... | grep -v vendor)
go test -v $(shell go list ./... | grep -v vendor)

gofuzz_binary:
rm -rf tests/fuzz/binary/corpus/
Expand All @@ -60,46 +60,12 @@ gofuzz_json:
fmt:
@go fmt ./...

metalinter:
@echo "==> Running linter"
gometalinter.v2 --vendor --deadline=600s --disable-all \
--enable=deadcode \
--enable=goconst \
--enable=goimports \
--enable=gosimple \
--enable=ineffassign \
--enable=megacheck \
--enable=misspell \
--enable=staticcheck \
--enable=safesql \
--enable=structcheck \
--enable=unconvert \
--enable=unused \
--enable=varcheck \
--enable=vetshadow \
./...

#--enable=maligned \
#--enable=gas \
#--enable=aligncheck \
#--enable=dupl \
#--enable=errcheck \
#--enable=gocyclo \
#--enable=golint \ <== comments on anything exported
#--enable=gotype \
#--enable=interfacer \
#--enable=unparam \
#--enable=vet \
metalinter_all:
protoc $(INCLUDE) --lint_out=. types/*.proto
gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./...


test_golang1.10rc:
docker run -it -v "$(CURDIR):/go/src/github.com/tendermint/go-amino" -w "/go/src/github.com/tendermint/go-amino" golang:1.10-rc /bin/bash -ci "make get_tools all"
# look into .golangci.yml for enabling / disabling linters
lint:
@echo "--> Running linter"
@golangci-lint run

# To avoid unintended conflicts with file names, always add to .PHONY
# unless there is a reason not to.
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
.PHONY: build install check_tools get_tools update_tools test fmt metalinter metalinter_all
.PHONY: build install check_tools get_tools update_tools test

0 comments on commit 41350f1

Please sign in to comment.