From 5d52ec1a689c1dc18d5cb9dd64fba16894ba7b30 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Wed, 28 Nov 2018 12:04:34 +0800 Subject: [PATCH 1/2] refactor: replace lint to revive --- .drone.yml | 2 +- Makefile | 10 +++++----- config.toml | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 config.toml diff --git a/.drone.yml b/.drone.yml index 60f9cdf6a2451..ade5b30ae0784 100644 --- a/.drone.yml +++ b/.drone.yml @@ -72,7 +72,7 @@ pipeline: - make clean - make generate - make vet - - make lint + - make revive - make fmt-check - make swagger-check - make swagger-validate diff --git a/Makefile b/Makefile index 5e7e72df0bc5f..93690963bc19f 100644 --- a/Makefile +++ b/Makefile @@ -126,12 +126,12 @@ errcheck: fi errcheck $(PACKAGES) -.PHONY: lint -lint: - @hash golint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ - $(GO) get -u golang.org/x/lint/golint; \ +.PHONY: revive +revive: + @hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ + $(GO) get -u github.com/mgechev/revive; \ fi - for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done; + revive -config config.toml -exclude=./vendor/... ./... || exit 1 .PHONY: misspell-check misspell-check: diff --git a/config.toml b/config.toml new file mode 100644 index 0000000000000..74743d5ef4d4f --- /dev/null +++ b/config.toml @@ -0,0 +1,25 @@ +ignoreGeneratedHeader = false +severity = "warning" +confidence = 0.8 +errorCode = 1 +warningCode = 1 + +[rule.blank-imports] +[rule.context-as-argument] +[rule.context-keys-type] +[rule.dot-imports] +[rule.error-return] +[rule.error-strings] +[rule.error-naming] +[rule.exported] +[rule.if-return] +[rule.increment-decrement] +[rule.var-naming] +[rule.var-declaration] +[rule.package-comments] +[rule.range] +[rule.receiver-naming] +[rule.time-naming] +[rule.unexported-return] +[rule.indent-error-flow] +[rule.errorf] From 8f2247df10e34850d2990ce8c5a057ac30a04dd0 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Mon, 3 Dec 2018 22:18:08 +0800 Subject: [PATCH 2/2] make changes. Signed-off-by: Bo-Yi Wu --- .drone.yml | 2 +- config.toml => .revive.toml | 0 Makefile | 6 +++--- 3 files changed, 4 insertions(+), 4 deletions(-) rename config.toml => .revive.toml (100%) diff --git a/.drone.yml b/.drone.yml index ade5b30ae0784..60f9cdf6a2451 100644 --- a/.drone.yml +++ b/.drone.yml @@ -72,7 +72,7 @@ pipeline: - make clean - make generate - make vet - - make revive + - make lint - make fmt-check - make swagger-check - make swagger-validate diff --git a/config.toml b/.revive.toml similarity index 100% rename from config.toml rename to .revive.toml diff --git a/Makefile b/Makefile index 93690963bc19f..f007665e7107f 100644 --- a/Makefile +++ b/Makefile @@ -126,12 +126,12 @@ errcheck: fi errcheck $(PACKAGES) -.PHONY: revive -revive: +.PHONY: lint +lint: @hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ $(GO) get -u github.com/mgechev/revive; \ fi - revive -config config.toml -exclude=./vendor/... ./... || exit 1 + revive -config .revive.toml -exclude=./vendor/... ./... || exit 1 .PHONY: misspell-check misspell-check: