📖 Update README.md - With instructions for GolangCI 2x#109
📖 Update README.md - With instructions for GolangCI 2x#109camilamacedo86 wants to merge 1 commit intokubernetes-sigs:mainfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: camilamacedo86 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| ##### Enabling Specific Linters (Valid for Versions < 2.x) | ||
|
|
||
| > **Note**: The following configuration is only supported when using the **module integration** via `.custom-gcl.yml` and is **not valid in plugin mode** (`.so` files with `golangci-lint` v2.x+). |
There was a problem hiding this comment.
This isn't true, you can do exactly the same configuration between both versions
There was a problem hiding this comment.
I tried it, but it did not work out.
Now, with your message, I found: https://github.com/golangci/golangci-lint/blob/main/.custom-gcl.reference.yml
It might changed the format. I will try out after.
Thanks!
There was a problem hiding this comment.
I was trying but I could not make work yet see: kubernetes-sigs/kubebuilder#4941
(I will spend more effort on it later, but if you'd like, take a look. (Not sure what I am missing)
| linters-settings: | ||
| custom: | ||
| kubeapilinter: | ||
| path: "bin/kube-api-linter.so" | ||
| description: Kube API LInter lints Kube like APIs based on API conventions and best practices. | ||
| original-url: sigs.k8s.io/kube-api-linter | ||
| settings: | ||
| linters: {} | ||
| lintersConfig: {} |
There was a problem hiding this comment.
Looking at the diff above, it seems we just need to update this section slightly, and the rest remains true and the same?
| exclusions: | ||
| rules: | ||
| # Only run kubeapilinter inside the 'api/' directory | ||
| # Prevents running API-specific checks on unrelated packages like controllers or tests | ||
| - path-except: "^api/" | ||
| linters: | ||
| - kubeapilinter |
There was a problem hiding this comment.
Is the formatting off for the exclusions stanza here? It looks like it needs to be linters.exclusions when I was looking at integrating this linter in my repository that uses the 2.x golangci-lint version.
There was a problem hiding this comment.
Looks to me like this aligns with Cluster API which is also using golangci-lint version 2
There was a problem hiding this comment.
Right, that's what we have as well. In this example, the linters and exclusions fields are on the same level though. I think you'd have to indent the exclusions field once so it's nested under the linters field.
There was a problem hiding this comment.
Oh I get your point, yes, you're correct, this whole block from exclusions down needs indenting 2 spaces
|
|
||
| ```yaml | ||
| version: v1.64.8 | ||
| version: v1.64.8 # GolangCi version |
There was a problem hiding this comment.
fwiw, I had to update this value to v2.5.0 today, and along with prefixing with version: "2", that was I needed to get the current default configuration to work.
☸ kind-kind in ~
❯ cat .golangci.yml
version: "2"
linters:
disable-all: true
enable:
- kubeapilinter
settings:
custom:
kubeapilinter:
type: "module"
description: Kube API LInter lints Kube like APIs based on API conventions and best practices.
settings:
linters: {}
lintersConfig: {}
☸ kind-kind in ~
❯ cat .custom-gcl.yml
version: v2.5.0
name: golangci-kube-api-linter
destination: ./bin
plugins:
- module: 'sigs.k8s.io/kube-api-linter'
version: 'main' # Replace with the latest version|
/close #175 has taken this over |
|
@JoelSpeed: Closed this PR. DetailsIn response to this:
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-sigs/prow repository. |
|
PR needs rebase. DetailsInstructions 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-sigs/prow repository. |
No description provided.