-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Expand file tree
/
Copy path.golangci.yaml
More file actions
214 lines (211 loc) · 6.06 KB
/
Copy path.golangci.yaml
File metadata and controls
214 lines (211 loc) · 6.06 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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
version: "2"
run:
timeout: 7m
linters:
enable:
- dogsled
- errcheck
- gocritic
- govet
- gocyclo
- ineffassign
- misspell
- nakedret
- revive
- staticcheck
- unconvert
- unparam
- unused
settings:
staticcheck:
checks:
# Below is the default set
- "all"
- "-ST1000"
- "-ST1003"
- "-ST1016"
- "-ST1020"
- "-ST1021"
- "-ST1022"
- "-ST1005"
# Omit embedded fields from selector expression
- "-QF1008"
revive:
enable-all-rules: true
rules:
# See https://revive.run/r
##### P0
- name: max-control-nesting
arguments: [5]
- name: enforce-switch-style
arguments: ["allow-no-default"]
##### P1: consider making a dent on these, but not critical.
- name: argument-limit
arguments: [12]
- name: unnecessary-stmt
disabled: true
- name: defer
disabled: true
- name: confusing-naming
disabled: true
- name: early-return
disabled: true
- name: function-result-limit
arguments: [7]
- name: function-length
arguments: [0, 400]
- name: cyclomatic
arguments: [100]
- name: unhandled-error
disabled: true
- name: cognitive-complexity
arguments: [197]
##### P2: nice to have.
- name: max-public-structs
arguments: [25]
- name: confusing-results
disabled: true
- name: comment-spacings
disabled: true
- name: use-any
disabled: true
- name: empty-lines
disabled: true
- name: package-comments
disabled: true
- name: exported
disabled: true
###### Permanently disabled. Below have been reviewed and vetted to be unnecessary.
- name: line-length-limit
disabled: true
- name: nested-structs
disabled: true
- name: flag-parameter
disabled: true
- name: unused-parameter
disabled: true
- name: unused-receiver
disabled: true
- name: add-constant
disabled: true
###### Redundant with other linters.
- name: error-strings
disabled: true # staticcheck ST1005 handles this and catches more cases
###### Opinionated style rules - permanently disabled.
- name: if-return
disabled: true
- name: unsecure-url-scheme
disabled: true
###### To be determined, this is a rule with differences.
- name: import-alias-naming
disabled: true
- name: unexported-naming
disabled: true
- name: struct-tag
disabled: true
- name: redundant-import-alias
disabled: true
gocritic:
# See https://go-critic.com/overview.html
disabled-checks:
# Below are normally enabled by default, but we do not pass
- appendAssign
- ifElseChain
- unslice
- badCall
- assignOp
- commentFormatting
- captLocal
- singleCaseSwitch
- wrapperFunc
- elseif
- regexpMust
- deprecatedComment
enabled-checks:
# Below used to be enabled, but we do not pass anymore
# - paramTypeCombine
# - octalLiteral
# - unnamedResult
# - equalFold
# - sloppyReassign
# - emptyStringTest
# - hugeParam
# - appendCombine
# - stringXbytes
# - ptrToRefParam
# - commentedOutCode
# - rangeValCopy
# - methodExprCall
# - yodaStyleExpr
# - typeUnparen
# We enabled these and we pass
- nilValReturn
- weakCond
- indexAlloc
- rangeExprCopy
- boolExprSimplify
- commentedOutImport
- docStub
- emptyFallthrough
- hexLiteral
- typeAssertChain
- unlabelStmt
- builtinShadow
- importShadow
- initClause
- nestingReduce
- unnecessaryBlock
exclusions:
paths:
# we generally dont wanna touch or lint the Third_party code, it is basically like a fork for code that we can not import.
# but have to copy/paste
- third_party
# Deprecated driver, no one can test changes.
- pkg/drivers/parallels/
# Skip test files
- '(.+)_test\.go'
rules:
# I think this check is meaningless.
- path: '(.+)\.go$'
text: "Error return value of `.*` is not checked"
linter: errcheck
# Allow deep-exit in CLI command files, exit helpers, and main entry points
- path: 'cmd/'
text: "deep-exit:"
linter: revive
- path: 'deploy/'
text: "deep-exit:"
linter: revive
- path: 'pkg/minikube/exit/'
text: "deep-exit:"
linter: revive
# Allow deep-exit in libmachine driver plugins, which run as standalone sub-processes communicating via RPC
- path: 'pkg/libmachine/drivers/plugin/'
text: "deep-exit:"
linter: revive
- path: 'pkg/gvisor/'
text: "deep-exit:"
linter: revive
# Ignore package-naming rule in pkg/util/ because renaming the package would be a massive, high-risk refactoring affecting the entire codebase.
- path: 'pkg/util/'
text: "package-naming:"
linter: revive
# Ignore package-naming rule in pkg/drivers/common/ because renaming it would create massive code churn and refactoring.
- path: 'pkg/drivers/common/'
text: "package-naming:"
linter: revive
# pkg/libmachine/log shadows the standard library "log" package, but renaming it would touch the entire codebase.
- path: 'pkg/libmachine/log/'
text: "package-naming:"
linter: revive
# Existing bare returns in route_darwin.go - fix later.
- path: 'pkg/minikube/tunnel/route_darwin.go'
text: "bare-return:"
linter: revive
formatters:
enable:
- gofmt
- goimports
exclusions:
paths:
- third_party