diff --git a/.golangci-required.yml b/.golangci-required.yml new file mode 100644 index 000000000..999f05c2d --- /dev/null +++ b/.golangci-required.yml @@ -0,0 +1,25 @@ +--- +# The most valuable linters; they are required to pass for PR to be merged. + +linters-settings: + depguard: + list-type: blacklist + include-go-root: true + packages: + # use "github.com/pkg/errors" instead + - errors + + goimports: + local-prefixes: github.com/percona/mongodb_exporter + +linters: + disable-all: true + enable: + - depguard + - goimports + - ineffassign + - govet + - staticcheck + +issues: + exclude-use-default: false diff --git a/.travis.yml b/.travis.yml index 72f1561e0..7a465439b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,6 +38,16 @@ env: - MONGODB_IMAGE=percona/percona-server-mongodb:3.6 - MONGODB_IMAGE=percona/percona-server-mongodb:4.0 +install: + # install reviewdog and golangci-lin + - curl https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s + - curl https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s latest + +before_script: + # static analyze + - bin/golangci-lint run -c=.golangci-required.yml --out-format=line-number | bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-check + - bin/golangci-lint run -c=.golangci.yml --out-format=line-number | bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-review + script: make test-all jobs: