Skip to content

Commit 74075c8

Browse files
authored
Merge pull request #96 from pmalek/readme-update
chore: update README with guide how to enable and disable linter checks
2 parents 2819026 + 012e25c commit 74075c8

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,23 @@ issues:
6363
- kubeapilinter
6464
```
6565

66+
If you wish to only run selected linters you can do so by specifying the linters you want to enable in the `linters` section:
67+
68+
```yaml
69+
linters-settings:
70+
custom:
71+
kubeapilinter:
72+
type: "module"
73+
settings:
74+
linters:
75+
disable:
76+
- "*"
77+
enable:
78+
- requiredfields
79+
- statusoptional
80+
- statussubresource
81+
```
82+
6683
The settings for Kube API Linter are based on the [GolangCIConfig][golangci-config-struct] struct and allow for finer control over the linter rules.
6784

6885
If you wish to use the Kube API Linter in conjunction with other linters, you can enable the Kube API Linter in the `.golangci.yml` file by ensuring that `kubeapilinter` is in the `linters.enabled` list.
@@ -199,12 +216,18 @@ When the `json` tag is present, and matches the first word of the field comment
199216
The duplicatemarkers linter checks for exact duplicates of markers for types and fields.
200217
This means that something like:
201218

219+
```go
202220
// +kubebuilder:validation:MaxLength=10
203-
// +kubebuilder:validation:MaxLength=10
221+
// +kubebuilder:validation:MaxLength=10
222+
```
223+
204224
Will be flagged by this linter, while something like:
205225

226+
```go
206227
// +kubebuilder:validation:MaxLength=10
207228
// +kubebuilder:validation:MaxLength=11
229+
```
230+
208231
will not.
209232

210233
### Fixes
@@ -369,7 +392,7 @@ The linter will then only suggest to remove the `omitempty` value from the `json
369392
The `statusoptional` linter checks that all first-level children fields within a status struct are marked as optional.
370393

371394
This is important because status fields should be optional to allow for partial updates and backward compatibility.
372-
The linter ensures that all direct child fields of any status struct have either the `// +optional` or
395+
The linter ensures that all direct child fields of any status struct have either the `// +optional` or
373396
`// +kubebuilder:validation:Optional` marker.
374397

375398
### Fixes

0 commit comments

Comments
 (0)