Run revive linter in CI (#8798)
* Run revive linter in CI Just output the results, don't fail on it Removed the rule.exported rule * Move revive install to CI * new line * Use golangci-lint * Get v1.37 * increase timeout by a minute * try five minutes * newline missing * Update config
This commit is contained in:
parent
b6b5d34060
commit
660eb5b63c
|
|
@ -71,6 +71,14 @@ commands:
|
|||
paths:
|
||||
- 'dist'
|
||||
jobs:
|
||||
linter:
|
||||
executor: go-1_15
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: go-mod-v1-{{ checksum "go.sum" }}
|
||||
- run: wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.37.0
|
||||
- run: make lint
|
||||
deps:
|
||||
executor: go-1_15
|
||||
steps:
|
||||
|
|
@ -178,6 +186,7 @@ workflows:
|
|||
version: 2
|
||||
check:
|
||||
jobs:
|
||||
- 'linter'
|
||||
- 'macdeps':
|
||||
filters:
|
||||
tags:
|
||||
|
|
@ -246,6 +255,7 @@ workflows:
|
|||
- 'release'
|
||||
nightly:
|
||||
jobs:
|
||||
- 'linter'
|
||||
- 'deps'
|
||||
- 'macdeps'
|
||||
- 'test-go-1_14':
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
linters:
|
||||
enable:
|
||||
- revive
|
||||
|
||||
linters-settings:
|
||||
revive:
|
||||
rules:
|
||||
- name: blank-imports
|
||||
- name: context-as-argument
|
||||
- name: context-keys-type
|
||||
- name: dot-imports
|
||||
- name: error-return
|
||||
- name: error-strings
|
||||
- name: error-naming
|
||||
- name: exported
|
||||
- name: if-return
|
||||
- name: increment-decrement
|
||||
- name: var-naming
|
||||
- name: var-declaration
|
||||
- name: package-comments
|
||||
- name: range
|
||||
- name: receiver-naming
|
||||
- name: time-naming
|
||||
- name: unexported-return
|
||||
- name: indent-error-flow
|
||||
- name: errorf
|
||||
- name: empty-block
|
||||
- name: superfluous-else
|
||||
- name: unused-parameter
|
||||
- name: unreachable-code
|
||||
- name: redefines-builtin-id
|
||||
|
||||
run:
|
||||
skip-dirs:
|
||||
- scripts
|
||||
- docs
|
||||
- etc
|
||||
skip-files:
|
||||
- plugins/parsers/influx/machine.go*
|
||||
|
||||
issues:
|
||||
exclude:
|
||||
- don't use an underscore in package name
|
||||
- exported.*should have comment.*or be unexported
|
||||
10
Makefile
10
Makefile
|
|
@ -75,6 +75,7 @@ help:
|
|||
@echo ' test - run short unit tests'
|
||||
@echo ' fmt - format source files'
|
||||
@echo ' tidy - tidy go modules'
|
||||
@echo ' lint - run linter'
|
||||
@echo ' check-deps - check docs/LICENSE_OF_DEPENDENCIES.md'
|
||||
@echo ' clean - delete build artifacts'
|
||||
@echo ''
|
||||
|
|
@ -130,6 +131,15 @@ vet:
|
|||
exit 1; \
|
||||
fi
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
ifeq (, $(shell which golangci-lint))
|
||||
$(info golangci-lint can't be found, please install it: https://golangci-lint.run/usage/install/)
|
||||
exit 1
|
||||
endif
|
||||
|
||||
golangci-lint run --timeout 5m0s --issues-exit-code 0
|
||||
|
||||
.PHONY: tidy
|
||||
tidy:
|
||||
go mod verify
|
||||
|
|
|
|||
Loading…
Reference in New Issue