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
+44-38Lines changed: 44 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ go build -o ./bin ./cmd/golangci-lint-kube-api-linter
21
21
22
22
The binary builds a custom version of `golangci-lint` with Kube API Linter included as a module.
23
23
See [Golangci-lint Moduule](#golangci-lint-module) for details on configuration of the module
24
-
under `linter-settings`.
24
+
under `settings`.
25
25
26
26
### Golangci-lint Module
27
27
@@ -59,53 +59,57 @@ If you wish to only use the Kube API Linter rules, you can configure your `.gola
59
59
60
60
```yaml
61
61
version: "2"
62
-
linters-settings:
63
-
custom:
64
-
kubeapilinter:
65
-
type: "module"
66
-
description: Kube API Linter lints Kube like APIs based on API conventions and best practices.
67
-
settings:
68
-
linters: {}
69
-
lintersConfig: {}
70
62
71
63
linters:
72
-
disable-all: true
64
+
default: none
73
65
enable:
74
66
- kubeapilinter
75
67
76
-
# To only run Kube API Linter on specific path
77
-
issues:
78
-
exclude-rules:
79
-
- path-except: "api/*"
80
-
linters:
81
-
- kubeapilinter
68
+
settings:
69
+
custom:
70
+
kubeapilinter:
71
+
type: module
72
+
description: Kube API Linter lints Kube like APIs based on API conventions and best practices.
73
+
settings:
74
+
linters: {}
75
+
lintersConfig: {}
76
+
77
+
# To only run Kube API Linter on specific path
78
+
exclusions:
79
+
rules:
80
+
- linters:
81
+
- kubeapilinter
82
+
path-except: api/*
83
+
82
84
```
83
85
84
86
If you wish to only run selected linters you can do so by specifying the linters you want to enable in the `linters` section:
85
87
86
88
```yaml
87
89
version: "2"
88
-
linters-settings:
89
-
custom:
90
-
kubeapilinter:
91
-
type: "module"
92
-
settings:
93
-
linters:
94
-
disable:
95
-
- "*"
96
-
enable:
97
-
- requiredfields
98
-
- statusoptional
99
-
- statussubresource
90
+
100
91
linters:
101
92
enable:
102
93
- kubeapilinter
94
+
95
+
settings:
96
+
custom:
97
+
kubeapilinter:
98
+
type: "module"
99
+
settings:
100
+
linters:
101
+
disable:
102
+
- "*"
103
+
enable:
104
+
- requiredfields
105
+
- statusoptional
106
+
- statussubresource
103
107
```
104
108
105
109
The settings for Kube API Linter are based on the [GolangCIConfig][golangci-config-struct] struct and allow for finer control over the linter rules.
106
110
107
111
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.
108
-
To provide further configuration, add the `custom.kubeapilinter` section to your `linter-settings` as per the example above.
112
+
To provide further configuration, add the `custom.kubeapilinter` section to your `settings` as per the example above.
@@ -142,18 +146,20 @@ The `golangci-lint` configuration is similar to the module configuration, howeve
142
146
143
147
```yaml
144
148
version: "2"
145
-
linters-settings:
146
-
custom:
147
-
kubeapilinter:
148
-
path: "bin/kube-api-linter.so"
149
-
description: Kube API Linter lints Kube like APIs based on API conventions and best practices.
150
-
original-url: sigs.k8s.io/kube-api-linter
151
-
settings:
152
-
linters: {}
153
-
lintersConfig: {}
149
+
154
150
linters:
155
151
enable:
156
152
- kubeapilinter
153
+
154
+
settings:
155
+
custom:
156
+
kubeapilinter:
157
+
path: "bin/kube-api-linter.so"
158
+
description: Kube API Linter lints Kube like APIs based on API conventions and best practices.
159
+
original-url: sigs.k8s.io/kube-api-linter
160
+
settings:
161
+
linters: {}
162
+
lintersConfig: {}
157
163
```
158
164
159
165
The rest of the configuration is the same as the module configuration, except the standard `golangci-lint` binary is invoked, rather than a custom binary.
0 commit comments