-
Notifications
You must be signed in to change notification settings - Fork 121
Expand file tree
/
Copy path.golangci.yml
More file actions
195 lines (187 loc) · 4.6 KB
/
.golangci.yml
File metadata and controls
195 lines (187 loc) · 4.6 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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# SPDX-FileCopyrightText: 2023 The Crossplane Authors <https://crossplane.io>
#
# SPDX-License-Identifier: CC0-1.0
version: "2"
output:
formats:
text:
path: stdout
print-linter-name: true
linters:
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- contextcheck
- durationcheck
- errchkjson
- errorlint
- exhaustive
- gocheckcompilerdirectives
- gochecksumtype
- goconst
- gocritic
- gocyclo
- gosec
- gosmopolitan
- loggercheck
- makezero
- misspell
- musttag
- nakedret
- nilerr
- nilnesserr
- noctx
- nolintlint
- prealloc
- protogetter
- reassign
- recvcheck
- revive
- rowserrcheck
- spancheck
- sqlclosecheck
- testifylint
- unconvert
- unparam
- zerologlint
settings:
dupl:
threshold: 100
errcheck:
check-type-assertions: false
check-blank: false
exclude-functions:
- io/ioutil.ReadFile
- io/ioutil.ReadDir
- io/ioutil.ReadAll
goconst:
min-len: 3
min-occurrences: 5
gocritic:
enabled-tags:
- performance
settings:
captLocal:
paramsOnly: true
rangeValCopy:
sizeThreshold: 32
gocyclo:
min-complexity: 10
lll:
tab-width: 1
nakedret:
max-func-lines: 30
nolintlint:
require-explanation: false
require-specific: true
prealloc:
simple: true
range-loops: true
for-loops: false
revive:
confidence: 0.8
unparam:
check-exported: false
exclusions:
generated: lax
rules:
# Exclude some linters from running on tests files.
- linters:
- dupl
- errcheck
- gocyclo
- gosec
- scopelint
- unparam
path: _test(ing)?\.go
# Ease some gocritic warnings on test files.
- linters:
- gocritic
path: _test\.go
text: (unnamedResult|exitAfterDefer)
# These are performance optimisations rather than style issues per se.
# They warn when function arguments or range values copy a lot of memory
# rather than using a pointer.
- linters:
- gocritic
text: '(hugeParam|rangeValCopy):'
# This "TestMain should call os.Exit to set exit code" warning is not clever
# enough to notice that we call a helper method that calls os.Exit.
- linters:
- staticcheck
text: 'SA3000:'
# This is a "potential hardcoded credentials" warning. It's triggered by
# any variable with 'secret' in the same, and thus hits a lot of false
# positives in Kubernetes land where a Secret is an object type.
- linters:
- gosec
text: 'G101:'
# This is an 'errors unhandled' warning that duplicates errcheck.
- linters:
- gosec
text: 'G104:'
# Some k8s dependencies do not have JSON tags on all fields in structs.
- linters:
- musttag
path: k8s.io/
# This exclusion is necessary because this package relies on deprecated
# functions and fields to maintain compatibility with older versions. This
# package acts as a migration framework, supporting users coming from
# previous versions. In the future, we may extract this package into a
# separate module and decouple its dependencies from upjet.
- linters:
- staticcheck
path: pkg/migration/
text: 'SA1019:'
- linters:
- staticcheck
text: 'QF1008:'
# Ease some deprecated field usage, we still handle them
- linters:
- staticcheck
path: pkg/types/reference.go
text: 'SA1019:'
- linters:
- staticcheck
path: pkg/types/markers/crossplane.go
text: 'SA1019:'
- linters:
- govet
text: 'buildtag:'
path: pkg/generate.go
- linters:
- nolintlint
path: pkg/controller/proposed_state.go
paths:
- third_party$
- builtin$
- examples$
issues:
# Maximum issues count per one linter. Set to 0 to disable.
max-issues-per-linter: 0
# Maximum count of issues with the same text. Set to 0 to disable.
max-same-issues: 0
new: false
formatters:
enable:
- gci
- gofmt
settings:
gci:
sections:
- standard
- default
- prefix(github.com/crossplane/upjet)
- blank
- dot
custom-order: true
gofmt:
simplify: true
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$