-
Notifications
You must be signed in to change notification settings - Fork 14
/
.golangci.yaml
163 lines (158 loc) · 4.26 KB
/
.golangci.yaml
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
run:
timeout: 5m
linters:
enable:
- asciicheck
- bodyclose
- copyloopvar
- dogsled
- durationcheck
- errcheck
- errorlint
- exhaustive
- forbidigo
- gci
- gocritic
- gofmt
- goimports
- gomodguard
- gosec
- gosimple
- govet
- importas
- ineffassign
- misspell
- nakedret
- nilerr
- nolintlint
- predeclared
- revive
- staticcheck
- typecheck
- unconvert
- unparam
- unused
- wastedassign
linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/kong/kubernetes-configuration)
- prefix(github.com/kong/gateway-operator)
govet:
enable-all: true # To have checks like e.g. unusedwrite.
disable:
- fieldalignment
- shadow
importas:
no-unaliased: true
alias:
- pkg: k8s.io/api/([a-z])/(v[\w\d]+)
alias: ${1}${2}
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
alias: metav1
- pkg: sigs.k8s.io/gateway-api/apis/(v[\w\d]+)
alias: gateway${1}
- pkg: sigs.k8s.io/controller-runtime/pkg/log
alias: ctrllog
- pkg: github.com/kong/gateway-operator/internal/types
alias: gwtypes
- pkg: github.com/kong/kubernetes-configuration/api/configuration/([\w\d]+)
alias: configuration${1}
- pkg: github.com/Kong/sdk-konnect-go/models/components
alias: sdkkonnectcomp
- pkg: github.com/Kong/sdk-konnect-go/models/operations
alias: sdkkonnectops
- pkg: github.com/Kong/sdk-konnect-go/models/sdkerrors
alias: sdkkonnecterrs
- pkg: github.com/kong/gateway-operator/controller/konnect/ops/sdk
alias: sdkops
- pkg: github.com/kong/gateway-operator/controller/konnect/ops/sdk/mocks
alias: sdkmocks
revive:
rules:
- name: errorf
severity: warning
disabled: false
- name: error-strings
severity: warning
disabled: false
- name: error-naming
severity: warning
disabled: false
- name: duplicated-imports
severity: warning
disabled: false
- name: empty-block
severity: warning
disabled: false
- name: exported
severity: warning
disabled: false
arguments:
- "checkPrivateReceivers"
# TODO: enable this when ready to refactor exported types that stutter at call site.
- "disableStutteringCheck"
- name: context-as-argument
# TODO: re-add this rule after https://github.com/golangci/golangci-lint/issues/3280
# is resolved and released.
# arguments:
# - "allowTypesBefore": "*testing.T"
disabled: true
exhaustive:
default-signifies-exhaustive: true
gomodguard:
blocked:
modules:
- golang.org/x/exp:
recommendations:
- maps
- slices
- github.com/samber/lo
- github.com/pkg/errors:
recommendations:
- fmt
- errors
- github.com/sirupsen/logrus:
recommendations:
- sigs.k8s.io/controller-runtime/pkg/log
- go.uber.org/zap/zapcore
forbidigo:
forbid:
- p: ^.*Dataplane.*$
msg: "Please use camel case 'DataPlane' instead of 'Dataplane'"
- p: ^.*Controlplane.*$
msg: "Please use camel case 'ControlPlane' instead of 'Controlplane'"
issues:
max-same-issues: 0
fix: true
exclude-dirs:
- pkg/clientset
- config/
include:
- EXC0012
exclude-rules:
# Exclude checking exported comments in internal/ which cannot be used from outside.
- path: internal/
linters:
- revive
text: "exported: exported"
# Test cases are self-explanatory, thus no need a docstring.
- path: test/integration
linters:
- revive
text: "exported: exported"
- path: test/e2e
linters:
- revive
text: "exported: exported"
# Generated mock SDKs does not need comments on generated methods.
- path: controller/konnect/ops/.*_mock\.go
linters:
- revive
text: "exported: exported"
# Methods imported from the SDK do not use the camel case naming convention for DP and we have no control over it.
- linters:
- forbidigo
text: 'use of `.*(Create|Delete)Dataplane.+` forbidden because "Please use camel case'