Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tune linters #3848

Merged
merged 1 commit into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ linters-settings:
# Rule tuning
- name: argument-limit
arguments:
- 4
- 10
- name: cognitive-complexity
arguments:
- 15
- 25
- name: cyclomatic
arguments:
- 10
- 15
- name: function-result-limit
arguments:
- 3
28 changes: 18 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ bins: temporal-server temporal-cassandra-tool temporal-sql-tool tdbg
all: update-tools clean proto bins check test

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

# Delete all build artifacts
clean: clean-bins clean-test-results
Expand Down Expand Up @@ -108,13 +108,13 @@ SQL_PASSWORD ?= temporal
INTEGRATION_TEST_COVERPKG := -coverpkg="$(MODULE_ROOT)/common/persistence/...,$(MODULE_ROOT)/tools/..."
FUNCTIONAL_TEST_COVERPKG := -coverpkg="$(MODULE_ROOT)/client/...,$(MODULE_ROOT)/common/...,$(MODULE_ROOT)/service/...,$(MODULE_ROOT)/temporal/...,$(MODULE_ROOT)/tools/..."
##### Tools #####
update-checkers:
@printf $(COLOR) "Install/update check tools..."
update-goimports:
@printf $(COLOR) "Install/update goimports..."
@go install golang.org/x/tools/cmd/goimports@latest
@go install github.com/googleapis/api-linter/cmd/[email protected]
@go install github.com/bufbuild/buf/cmd/[email protected]
@go install github.com/golangci/golangci-lint/cmd/[email protected]

update-linters:
@printf $(COLOR) "Install/update linters..."
@go install github.com/golangci/golangci-lint/cmd/[email protected]

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

update-proto-linters:
@printf $(COLOR) "Install/update proto linters..."
@go install github.com/googleapis/api-linter/cmd/[email protected]
@go install github.com/bufbuild/buf/cmd/[email protected]

update-tctl:
@printf $(COLOR) "Install/update tctl..."
@go install github.com/temporalio/tctl/cmd/tctl@latest
Expand All @@ -133,7 +138,10 @@ update-ui:
@printf $(COLOR) "Install/update temporal ui-server..."
@go install github.com/temporalio/ui-server/cmd/server@latest

update-tools: update-checkers update-mockgen update-proto-plugins
update-tools: update-goimports update-linters update-mockgen update-proto-plugins update-proto-linters

# update-linters is not included because in CI linters are run by github actions.
ci-update-tools: update-goimports update-mockgen update-proto-plugins update-proto-linters
Comment on lines +143 to +144
Copy link
Member Author

@alexshtin alexshtin Jan 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This saves about 10s of build time because linters are not getting installed on Buildkite now.


##### Proto #####
$(PROTO_OUT):
Expand Down Expand Up @@ -224,8 +232,8 @@ copyright:
@go run ./cmd/tools/copyright/licensegen.go

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

api-linter:
@printf $(COLOR) "Run api-linter..."
Expand All @@ -247,7 +255,7 @@ shell-check:
@printf $(COLOR) "Run shellcheck for script files..."
@shellcheck $(ALL_SCRIPTS)

check: copyright-check
check: copyright-check lint shell-check

##### Tests #####
clean-test-results:
Expand Down