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
golangci-lint: synchronize configs and add verification for that #116367
Conversation
Skipping CI for Draft Pull Request. |
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/lgtm |
/hold I am in discussion with the golangci-lint author around the "stylecheck" TODO and will push an update before we merge this. |
/lgtm cancel 😄 |
It's also failing in the CI while it works locally. Will check... |
/test pull-kubernetes-verify |
/hold cancel Should work now and the feedback from the golangci-lint author is included: the |
/lgtm |
LGTM label has been added. Git tree hash: b73cffd2b830fab8b15a0b69f717d77716dbdbe4
|
/sig testing |
hack/golangci-strict.yaml
Outdated
- path: conversion\.go | ||
linters: | ||
- ineffassign | ||
|
||
linters: | ||
enable: # please keep this alphabetized | ||
disable-all: false # in contrast to golangci.yaml, the default set of linters remains enabled | ||
enable: # please keep this alphabetized and in sync with golangci-strict.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean golang-ci.yaml
here on line 21 right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the file really is called hack/golangci.yaml
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you mean the second line. Yes. It's the opposite of what it should be.
hack/golangci.yaml
Outdated
disable-all: true | ||
enable: # please keep this alphabetized | ||
disable-all: true # not disabled in golangci-strict.yaml | ||
enable: # please keep this alphabetized and in sync with golangci.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 22, similarly should be golangci-strict.yaml
hack/verify-golangci-lint-config.sh
Outdated
--ignore-matching-lines='^ *#' \ | ||
--ignore-matching-lines='#.*golangci\(-strict\)*.yaml' \ | ||
"${KUBE_ROOT}/hack/golangci.yaml" "${KUBE_ROOT}/hack/golangci-strict.yaml" ); then | ||
echo "hack/golangci.yaml and hack/golangci-strict.yaml are syncronized." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spelling - synchronized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what you get when these pesky Europeans pretend to write and review English... 😿
Fixed.
kubernetes#109728 added a golangci-strict.yaml where gingkolinter and stylecheck (some recent additions to golangci.yaml) were missing. To prevent such mistakes in the future, lines that are intentionally different get annotated with a comment about golangci-strict.yaml or golangci.yaml. Then a suitable diff command in the new verify-golangci-lint-config.sh checks that only such lines, comments and blank lines are different.
/approve |
LGTM label has been added. Git tree hash: 16fed42a229bb6dd45092c62955ba1c36e465d18
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dims, pohly The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@pohly: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/retest TestChangeCRD failed. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
#109728 added a golangci-strict.yaml where gingkolinter and stylecheck (some recent additions to golangci.yaml) were missing.
To prevent such mistakes in the future, lines that are intentionally different get annotated with a comment about golangci-strict.yaml or golangci.yaml. Then a suitable diff command in the new verify-golangci-lint-config.sh checks that only such lines, comments and blank lines are different.
Does this PR introduce a user-facing change?