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

Test var naming linter rule #42

Closed
Closed
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
11 changes: 3 additions & 8 deletions .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@ jobs:
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: ${{ steps.goversion.outputs.goversion }}
- id: golangci_lint_version
run: echo "golangci_lint_version=$(cd tools/mod && go list -m -f {{.Version}} github.com/golangci/golangci-lint)" >> "$GITHUB_OUTPUT"
- name: golangci-lint
uses: golangci/golangci-lint-action@9d1e0624a798bb64f6c3cea93db47765312263dc # v5.1.0
with:
version: ${{ steps.golangci_lint_version.outputs.golangci_lint_version }}
args: --config tools/.golangci.yaml
- run: |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@"$(cd tools/mod && go list -m -f {{.Version}} github.com/golangci/golangci-lint)"
- name: protoc
uses: arduino/setup-protoc@149f6c87b92550901b26acd1632e11c3662e381f # v1.3.0
with:
Expand All @@ -34,7 +29,7 @@ jobs:
- run: |
set -euo pipefail

make verify
GOLANGCI_LINT_PASS_OPTIONS='--out-format=github-actions --path-prefix=$MODULE_DIR' make verify
- run: |
set -euo pipefail

Expand Down
4 changes: 3 additions & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,9 @@ function govet_shadow_pass {
}

function lint_pass {
run_for_modules generic_checker run golangci-lint run --config "${ETCD_ROOT_DIR}/tools/.golangci.yaml"
local opts
read -ra opts <<< "${GOLANGCI_LINT_PASS_OPTIONS:-}"
run_for_modules generic_checker run golangci-lint run --config "${ETCD_ROOT_DIR}/tools/.golangci.yaml" "${opts[@]}"
}

function lint_fix_pass {
Expand Down
2 changes: 1 addition & 1 deletion scripts/test_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function run_for_module {
local module=${1:-"."}
shift 1
(
cd "${ETCD_ROOT_DIR}/${module}" && "$@"
cd "${ETCD_ROOT_DIR}/${module}" && "${@//\$MODULE_DIR/$module}"
)
}

Expand Down
7 changes: 5 additions & 2 deletions tools/.golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@ linters-settings: # please keep this alphabetized
- name: error-strings
severity: error
disabled: false
# TODO: enable the following rules
- name: var-naming
disabled: true
disabled: false
arguments:
- []
- ["GRPC", "WAL"]
# TODO: enable the following rules
- name: exported
disabled: true
- name: unexported-return
Expand Down
Loading