Skip to content

Commit b426f45

Browse files
committed
Adjust KAL config to exclude requiredfields false positives
1 parent 7061546 commit b426f45

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.golangci-kal.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ linters:
212212
text: "requiredfields: field .* is marked as required, but has the omitempty tag"
213213
linters:
214214
- kubeapilinter
215+
- path: "api/.*"
216+
text: "requiredfields: field (Applied|Value|Layout|RetryCount|Required|Prefix|TimeoutSeconds) is marked as required, should not be a pointer"
217+
linters:
218+
- kubeapilinter
215219

216220
# TODO: Excludes that should be removed once https://github.com/kubernetes-sigs/kube-api-linter/issues/132 will be fixed
217221
- path: "api/.*"
@@ -222,6 +226,7 @@ linters:
222226
text: "optionalfields: field (.*) is optional and has a valid zero value \\({}\\), but the validation is not complete \\(e.g. min properties/adding required fields\\). The field should be a pointer to allow the zero value to be set. If the zero value is not a valid use case, complete the validation and remove the pointer."
223227
linters:
224228
- kubeapilinter
229+
225230
issues:
226231
max-same-issues: 0
227232
max-issues-per-linter: 0

internal/controllers/clusterclass/clusterclass_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func assertStatusVariables(actualClusterClass *clusterv1.ClusterClass) error {
203203
return errors.Errorf("ClusterClass spec or status variable %s is nil, expected both to be set", specVar.Name)
204204
}
205205
if *specVar.Required != *statusVarDefinition.Required {
206-
return errors.Errorf("ClusterClass status variable %s required field does not match. Expected %v. Got %v", specVar.Name, statusVarDefinition.Required, statusVarDefinition.Required)
206+
return errors.Errorf("ClusterClass status variable %s required field does not match. Expected %v. Got %v", specVar.Name, *statusVarDefinition.Required, *statusVarDefinition.Required)
207207
}
208208
if !cmp.Equal(specVar.Schema, statusVarDefinition.Schema) {
209209
return errors.Errorf("ClusterClass status variable %s schema does not match. Expected %v. Got %v", specVar.Name, specVar.Schema, statusVarDefinition.Schema)

0 commit comments

Comments
 (0)