You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-2Lines changed: 25 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -63,6 +63,23 @@ issues:
63
63
- kubeapilinter
64
64
```
65
65
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
+
66
83
The settings for Kube API Linter are based on the [GolangCIConfig][golangci-config-struct] struct and allow for finer control over the linter rules.
67
84
68
85
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
199
216
The duplicatemarkers linter checks for exact duplicates of markers for types and fields.
200
217
This means that something like:
201
218
219
+
```go
202
220
// +kubebuilder:validation:MaxLength=10
203
-
// +kubebuilder:validation:MaxLength=10
221
+
// +kubebuilder:validation:MaxLength=10
222
+
```
223
+
204
224
Will be flagged by this linter, while something like:
205
225
226
+
```go
206
227
// +kubebuilder:validation:MaxLength=10
207
228
// +kubebuilder:validation:MaxLength=11
229
+
```
230
+
208
231
will not.
209
232
210
233
### Fixes
@@ -369,7 +392,7 @@ The linter will then only suggest to remove the `omitempty` value from the `json
369
392
The `statusoptional` linter checks that all first-level children fields within a status struct are marked as optional.
370
393
371
394
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
0 commit comments