From 4a091f2064022565ef7053b91577458fa6077f82 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 1 Jan 2022 08:45:59 +0800 Subject: [PATCH 1/3] chore(lint): remove revive and misspell checker. Signed-off-by: Bo-Yi Wu --- Makefile | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 4800bb480696c..28ac29078affc 100644 --- a/Makefile +++ b/Makefile @@ -157,7 +157,7 @@ all: build .PHONY: help help: @echo "Make Routines:" - @echo " - \"\" equivalent to \"build\"" + @echo " - \"\" equivalent to \"build\"" @echo " - build build everything" @echo " - frontend build frontend files" @echo " - backend build backend files" @@ -186,8 +186,6 @@ help: @echo " - generate-swagger generate the swagger spec from code comments" @echo " - swagger-validate check if the swagger spec is valid" @echo " - golangci-lint run golangci-lint linter" - @echo " - revive run revive linter" - @echo " - misspell check for misspellings" @echo " - vet examines Go source code and reports suspicious constructs" @echo " - test[\#TestSpecificName] run unit test" @echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite" @@ -280,29 +278,6 @@ errcheck: @echo "Running errcheck..." @errcheck $(GO_PACKAGES) -.PHONY: revive -revive: - @hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ - $(GO) install github.com/mgechev/revive@v1.1.2; \ - fi - @revive -config .revive.toml -exclude=./vendor/... ./... - -.PHONY: misspell-check -misspell-check: - @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ - $(GO) install github.com/client9/misspell/cmd/misspell@v0.3.4; \ - fi - @echo "Running misspell-check..." - @$(GO) run build/code-batch-process.go misspell -error -i unknwon '{file-list}' - -.PHONY: misspell -misspell: - @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ - $(GO) install github.com/client9/misspell/cmd/misspell@v0.3.4; \ - fi - @echo "Running go misspell..." - @$(GO) run build/code-batch-process.go misspell -w -i unknwon '{file-list}' - .PHONY: fmt-check fmt-check: # get all go files and run go fmt on them @@ -320,7 +295,7 @@ checks: checks-frontend checks-backend checks-frontend: svg-check .PHONY: checks-backend -checks-backend: misspell-check test-vendor swagger-check swagger-validate +checks-backend: test-vendor swagger-check swagger-validate .PHONY: lint lint: lint-frontend lint-backend @@ -332,7 +307,7 @@ lint-frontend: node_modules npx editorconfig-checker templates .PHONY: lint-backend -lint-backend: golangci-lint revive vet +lint-backend: golangci-lint vet .PHONY: watch watch: From bc57210695725659c02714d09b9d8fb86ba30b65 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 1 Jan 2022 15:32:22 +0800 Subject: [PATCH 2/3] fix: revert two space Signed-off-by: Bo-Yi Wu --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 28ac29078affc..00318b4afde47 100644 --- a/Makefile +++ b/Makefile @@ -157,7 +157,7 @@ all: build .PHONY: help help: @echo "Make Routines:" - @echo " - \"\" equivalent to \"build\"" + @echo " - \"\" equivalent to \"build\"" @echo " - build build everything" @echo " - frontend build frontend files" @echo " - backend build backend files" From c96f3ce58360d072b753327e66c90dad635322b5 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 1 Jan 2022 15:40:22 +0800 Subject: [PATCH 3/3] chore(lint): enable revive lint. Signed-off-by: Bo-Yi Wu --- .golangci.yml | 29 +++++++++++++++++++++++++++++ .revive.toml | 27 --------------------------- 2 files changed, 29 insertions(+), 27 deletions(-) delete mode 100644 .revive.toml diff --git a/.golangci.yml b/.golangci.yml index 9e64d71b594a7..235bb76715bdc 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,6 +16,7 @@ linters: - gocritic - bidichk - ineffassign + - revive enable-all: false disable-all: true fast: false @@ -28,6 +29,34 @@ linters-settings: disabled-checks: - ifElseChain - singleCaseSwitch # Every time this occurred in the code, there was no other way. + revive: + ignore-generated-header: false + severity: warning + confidence: 0.8 + errorCode: 1 + warningCode: 1 + 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: duplicated-imports + - name: modifies-value-receiver issues: exclude-rules: diff --git a/.revive.toml b/.revive.toml deleted file mode 100644 index 54f075f84f512..0000000000000 --- a/.revive.toml +++ /dev/null @@ -1,27 +0,0 @@ -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] -[rule.duplicated-imports] -[rule.modifies-value-receiver]