From fcefc6ea4cbbe473780aee5c632bb1936fc29526 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Wed, 28 Nov 2018 11:53:04 +0800 Subject: [PATCH] refactor: replace lint to revive --- .drone.yml | 2 +- Makefile | 8 ++++---- config.toml | 25 +++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 config.toml diff --git a/.drone.yml b/.drone.yml index e9c8a09..ed86282 100644 --- a/.drone.yml +++ b/.drone.yml @@ -14,7 +14,7 @@ pipeline: pull: true commands: - make vet - - make lint + - make revive - make test-vendor - make misspell-check - make test diff --git a/Makefile b/Makefile index af542b4..4f568e0 100644 --- a/Makefile +++ b/Makefile @@ -41,11 +41,11 @@ errcheck: fi errcheck $(PACKAGES) -lint: - @which golint > /dev/null; if [ $$? -ne 0 ]; then \ - $(GO) get -u golang.org/x/lint/golint; \ +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 unconvert: @which unconvert > /dev/null; if [ $$? -ne 0 ]; then \ diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..74743d5 --- /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]