Skip to content

Commit 4f53af9

Browse files
authored
Tune linters (#3848)
1 parent 5652dc4 commit 4f53af9

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

.golangci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ linters-settings:
6767
# Rule tuning
6868
- name: argument-limit
6969
arguments:
70-
- 4
70+
- 10
7171
- name: cognitive-complexity
7272
arguments:
73-
- 15
73+
- 25
7474
- name: cyclomatic
7575
arguments:
76-
- 10
76+
- 15
7777
- name: function-result-limit
7878
arguments:
7979
- 3

Makefile

+18-10
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ bins: temporal-server temporal-cassandra-tool temporal-sql-tool tdbg
99
all: update-tools clean proto bins check test
1010

1111
# Used by Buildkite.
12-
ci-build: bins build-tests update-tools shell-check check proto go-generate gomodtidy ensure-no-changes
12+
ci-build: bins build-tests ci-update-tools shell-check copyright-check proto go-generate gomodtidy ensure-no-changes
1313

1414
# Delete all build artifacts
1515
clean: clean-bins clean-test-results
@@ -108,13 +108,13 @@ SQL_PASSWORD ?= temporal
108108
INTEGRATION_TEST_COVERPKG := -coverpkg="$(MODULE_ROOT)/common/persistence/...,$(MODULE_ROOT)/tools/..."
109109
FUNCTIONAL_TEST_COVERPKG := -coverpkg="$(MODULE_ROOT)/client/...,$(MODULE_ROOT)/common/...,$(MODULE_ROOT)/service/...,$(MODULE_ROOT)/temporal/...,$(MODULE_ROOT)/tools/..."
110110
##### Tools #####
111-
update-checkers:
112-
@printf $(COLOR) "Install/update check tools..."
111+
update-goimports:
112+
@printf $(COLOR) "Install/update goimports..."
113113
@go install golang.org/x/tools/cmd/goimports@latest
114-
@go install github.com/googleapis/api-linter/cmd/api-linter@v1.32.3
115-
@go install github.com/bufbuild/buf/cmd/buf@v1.6.0
116-
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1
117114

115+
update-linters:
116+
@printf $(COLOR) "Install/update linters..."
117+
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1
118118

119119
update-mockgen:
120120
@printf $(COLOR) "Install/update mockgen tool..."
@@ -125,6 +125,11 @@ update-proto-plugins:
125125
@go install -modfile build/go.mod github.com/temporalio/gogo-protobuf/protoc-gen-gogoslick
126126
@go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
127127

128+
update-proto-linters:
129+
@printf $(COLOR) "Install/update proto linters..."
130+
@go install github.com/googleapis/api-linter/cmd/api-linter@v1.32.3
131+
@go install github.com/bufbuild/buf/cmd/buf@v1.6.0
132+
128133
update-tctl:
129134
@printf $(COLOR) "Install/update tctl..."
130135
@go install github.com/temporalio/tctl/cmd/tctl@latest
@@ -133,7 +138,10 @@ update-ui:
133138
@printf $(COLOR) "Install/update temporal ui-server..."
134139
@go install github.com/temporalio/ui-server/cmd/server@latest
135140

136-
update-tools: update-checkers update-mockgen update-proto-plugins
141+
update-tools: update-goimports update-linters update-mockgen update-proto-plugins update-proto-linters
142+
143+
# update-linters is not included because in CI linters are run by github actions.
144+
ci-update-tools: update-goimports update-mockgen update-proto-plugins update-proto-linters
137145

138146
##### Proto #####
139147
$(PROTO_OUT):
@@ -224,8 +232,8 @@ copyright:
224232
@go run ./cmd/tools/copyright/licensegen.go
225233

226234
lint:
227-
@printf $(COLOR) "Run linter..."
228-
@golangci-lint run
235+
@printf $(COLOR) "Run linters..."
236+
@golangci-lint run --verbose --timeout 10m --fix=false --new-from-rev=HEAD~ --config=.golangci.yml
229237

230238
api-linter:
231239
@printf $(COLOR) "Run api-linter..."
@@ -247,7 +255,7 @@ shell-check:
247255
@printf $(COLOR) "Run shellcheck for script files..."
248256
@shellcheck $(ALL_SCRIPTS)
249257

250-
check: copyright-check
258+
check: copyright-check lint shell-check
251259

252260
##### Tests #####
253261
clean-test-results:

0 commit comments

Comments
 (0)