Skip to content

Commit 948949f

Browse files
authored
chore(lint): use golangci-lint to call revive and misspell checker. (#18145)
replace revive and misspell with golangci-lint Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
1 parent 766cb48 commit 948949f

File tree

3 files changed

+31
-54
lines changed

3 files changed

+31
-54
lines changed

.golangci.yml

+29
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ linters:
1616
- gocritic
1717
- bidichk
1818
- ineffassign
19+
- revive
1920
enable-all: false
2021
disable-all: true
2122
fast: false
@@ -28,6 +29,34 @@ linters-settings:
2829
disabled-checks:
2930
- ifElseChain
3031
- singleCaseSwitch # Every time this occurred in the code, there was no other way.
32+
revive:
33+
ignore-generated-header: false
34+
severity: warning
35+
confidence: 0.8
36+
errorCode: 1
37+
warningCode: 1
38+
rules:
39+
- name: blank-imports
40+
- name: context-as-argument
41+
- name: context-keys-type
42+
- name: dot-imports
43+
- name: error-return
44+
- name: error-strings
45+
- name: error-naming
46+
- name: exported
47+
- name: if-return
48+
- name: increment-decrement
49+
- name: var-naming
50+
- name: var-declaration
51+
- name: package-comments
52+
- name: range
53+
- name: receiver-naming
54+
- name: time-naming
55+
- name: unexported-return
56+
- name: indent-error-flow
57+
- name: errorf
58+
- name: duplicated-imports
59+
- name: modifies-value-receiver
3160

3261
issues:
3362
exclude-rules:

.revive.toml

-27
This file was deleted.

Makefile

+2-27
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,6 @@ help:
186186
@echo " - generate-swagger generate the swagger spec from code comments"
187187
@echo " - swagger-validate check if the swagger spec is valid"
188188
@echo " - golangci-lint run golangci-lint linter"
189-
@echo " - revive run revive linter"
190-
@echo " - misspell check for misspellings"
191189
@echo " - vet examines Go source code and reports suspicious constructs"
192190
@echo " - test[\#TestSpecificName] run unit test"
193191
@echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite"
@@ -280,29 +278,6 @@ errcheck:
280278
@echo "Running errcheck..."
281279
@errcheck $(GO_PACKAGES)
282280

283-
.PHONY: revive
284-
revive:
285-
@hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
286-
$(GO) install github.com/mgechev/revive@v1.1.2; \
287-
fi
288-
@revive -config .revive.toml -exclude=./vendor/... ./...
289-
290-
.PHONY: misspell-check
291-
misspell-check:
292-
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
293-
$(GO) install github.com/client9/misspell/cmd/misspell@v0.3.4; \
294-
fi
295-
@echo "Running misspell-check..."
296-
@$(GO) run build/code-batch-process.go misspell -error -i unknwon '{file-list}'
297-
298-
.PHONY: misspell
299-
misspell:
300-
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
301-
$(GO) install github.com/client9/misspell/cmd/misspell@v0.3.4; \
302-
fi
303-
@echo "Running go misspell..."
304-
@$(GO) run build/code-batch-process.go misspell -w -i unknwon '{file-list}'
305-
306281
.PHONY: fmt-check
307282
fmt-check:
308283
# get all go files and run go fmt on them
@@ -320,7 +295,7 @@ checks: checks-frontend checks-backend
320295
checks-frontend: svg-check
321296

322297
.PHONY: checks-backend
323-
checks-backend: misspell-check test-vendor swagger-check swagger-validate
298+
checks-backend: test-vendor swagger-check swagger-validate
324299

325300
.PHONY: lint
326301
lint: lint-frontend lint-backend
@@ -332,7 +307,7 @@ lint-frontend: node_modules
332307
npx editorconfig-checker templates
333308

334309
.PHONY: lint-backend
335-
lint-backend: golangci-lint revive vet
310+
lint-backend: golangci-lint vet
336311

337312
.PHONY: watch
338313
watch:

0 commit comments

Comments
 (0)