Merge pull request #14488 from serathius/update-fix

Improve static analysis fixing scripts
This commit is contained in:
Benjamin Wang 2022-09-21 06:20:08 +08:00 committed by GitHub
commit 6333f375a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 19 deletions

View File

@ -12,4 +12,5 @@ jobs:
uses: golangci/golangci-lint-action@v3 uses: golangci/golangci-lint-action@v3
with: with:
version: v1.49.0 version: v1.49.0
- run: make verify - run: make verify
- run: make fix

View File

@ -67,8 +67,8 @@ See the [style doc](https://github.com/golang/go/wiki/CodeReviewComments) for de
Please ensure that your change passes static analysis (requires [golangci-lint](https://golangci-lint.run/usage/install/)): Please ensure that your change passes static analysis (requires [golangci-lint](https://golangci-lint.run/usage/install/)):
- `make verify` to verify if all checks pass. - `make verify` to verify if all checks pass.
- `make verify-*` to verify a single check, for example `make verify-bom` to verify if bill-of-materials.json file is up-to-date. - `make verify-*` to verify a single check, for example `make verify-bom` to verify if bill-of-materials.json file is up-to-date.
- `make update` to fix all checks. - `make fix` to fix all checks.
- `make update-*` to fix a single checks, for example `make update-bom` to update bill-of-materials.json. - `make fix-*` to fix a single checks, for example `make fix-bom` to update bill-of-materials.json.
Please ensure that your change passes tests. Please ensure that your change passes tests.
- `make test-unit` to run unit tests. - `make test-unit` to run unit tests.

View File

@ -29,8 +29,9 @@ test-e2e-release: build
# Static analysis # Static analysis
verify: verify-gofmt verify-bom verify-lint verify-dep verify-shellcheck verify-goword verify-govet verify-revive verify-license-header verify-receiver-name verify-mod-tidy verify-shellcheck verify-shellws verify-proto-annotations verify: verify-gofmt verify-bom verify-lint verify-dep verify-shellcheck verify-goword verify-govet verify-license-header verify-receiver-name verify-mod-tidy verify-shellcheck verify-shellws verify-proto-annotations
update: update-bom update-lint update-dep update-fix fix: fix-bom fix-lint
./scripts/fix.sh
.PHONY: verify-gofmt .PHONY: verify-gofmt
verify-gofmt: verify-gofmt:
@ -41,29 +42,21 @@ verify-bom:
PASSES="bom" ./scripts/test.sh PASSES="bom" ./scripts/test.sh
.PHONY: update-bom .PHONY: update-bom
update-bom: fix-bom:
./scripts/updatebom.sh ./scripts/updatebom.sh
.PHONY: verify-dep .PHONY: verify-dep
verify-dep: verify-dep:
PASSES="dep" ./scripts/test.sh PASSES="dep" ./scripts/test.sh
.PHONY: update-dep
update-dep:
./scripts/update_dep.sh
.PHONY: verify-lint .PHONY: verify-lint
verify-lint: verify-lint:
golangci-lint run golangci-lint run
.PHONY: update-lint .PHONY: update-lint
update-lint: fix-lint:
golangci-lint run --fix golangci-lint run --fix
.PHONY: update-fix
update-fix:
./scripts/fix.sh
.PHONY: verify-shellcheck .PHONY: verify-shellcheck
verify-shellcheck: verify-shellcheck:
PASSES="shellcheck" ./scripts/test.sh PASSES="shellcheck" ./scripts/test.sh
@ -76,10 +69,6 @@ verify-goword:
verify-govet: verify-govet:
PASSES="govet" ./scripts/test.sh PASSES="govet" ./scripts/test.sh
.PHONY: verify-revive
verify-revive:
PASSES="revive" ./scripts/test.sh
.PHONY: verify-license-header .PHONY: verify-license-header
verify-license-header: verify-license-header:
PASSES="license_header" ./scripts/test.sh PASSES="license_header" ./scripts/test.sh