-
Notifications
You must be signed in to change notification settings - Fork 125
Expand file tree
/
Copy path.golangci-kal.yaml
More file actions
64 lines (62 loc) · 2.4 KB
/
.golangci-kal.yaml
File metadata and controls
64 lines (62 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
version: "2"
run:
go: "1.24"
allow-parallel-runners: true
linters:
default: none
enable:
- kubeapilinter # linter for Kube API conventions
settings:
custom:
kubeapilinter:
type: module
description: KAL is the Kube-API-Linter and lints Kube like APIs based on API conventions and best practices.
settings:
linters:
disable:
- "optionalfields"
- "optionalorrequired"
- "nonpointerstructs"
- "nophase"
- "conditions"
- "arrayofstruct"
- "ssatags"
- "defaults"
lintersConfig:
conflictingmarkers:
conflicts:
- name: "default_vs_required"
sets:
- [ "default", "kubebuilder:default" ]
- [ "required", "kubebuilder:validation:Required", "k8s:required" ]
description: "A field with a default value cannot be required"
forbiddenmarkers:
markers:
# We don't want to do any defaulting (including OpenAPI) anymore on API fields because we prefer
# to have a clear signal on user intent. This also allows us to easily change the default behavior if necessary.
- identifier: "kubebuilder:default"
- identifier: "default"
conditions:
isFirstField: Warn # Require conditions to be the first field in the status struct.
usePatchStrategy: Forbid # Forbid patchStrategy markers on the Conditions field.
useProtobuf: Forbid # We don't use protobuf, so protobuf tags are not required.
optionalfields:
pointers:
preference: WhenRequired # Always | WhenRequired # Whether to always require pointers, or only when required. Defaults to `Always`.
policy: SuggestFix # SuggestFix | Warn # The policy for pointers in optional fields. Defaults to `SuggestFix`.
omitempty:
policy: SuggestFix # SuggestFix | Warn | Ignore # The policy for omitempty in optional fields. Defaults to `SuggestFix`.
exclusions:
generated: strict
paths:
- zz_generated.*\.go$
- ".*_test.go"
- "api/v1beta1/.*"
rules:
## KAL should only run on API folders.
- path: "api/v1beta1//*"
linters:
- kubeapilinter
issues:
max-same-issues: 0
max-issues-per-linter: 0