-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.golangci.yml
234 lines (214 loc) · 6.82 KB
/
.golangci.yml
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
---
run:
# GolangCI will not check files with build tags, unless specified here.
build-tags:
- integration
# All rules here were written in the time of GolangCI lint v1.54.1
linters:
enable:
# By Default
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- stylecheck
- typecheck # Not in the linter list, but keep it https://golangci-lint.run/usage/faq/#why-do-you-have-typecheck-errors
- unused
# Extra
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
- dogsled
- dupword
- durationcheck
- errchkjson
- errname
- errorlint
- exhaustive
- forbidigo
- gci
- ginkgolinter
- gocheckcompilerdirectives
- gocritic
- godot
# - goerr113 # As this is public SDK, would be nice to follow new error patterns
- gofmt
- goheader
- gosec
- gosmopolitan
- grouper
- lll
- loggercheck
- makezero
- mirror
- misspell
- nakedret
- nestif
- nilerr
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
- prealloc
- predeclared
- reassign
- revive
- tagalign
- testpackage
- unconvert
- unparam
- usestdlibvars
- wastedassign
- whitespace
linters-settings:
lll:
line-length: 120
tab-width: 4
gci:
# Keep in sync with GNUMakefile
sections:
- standard
- default
- prefix(github.com/indykite/indykite-sdk-go)
- blank
- dot
staticcheck:
checks: [all]
stylecheck:
checks: [all]
govet:
check-shadowing: true
enable-all: true
gocritic:
enabled-tags:
- diagnostic
- style
- performance
- experimental
- opinionated
disabled-checks:
- whyNoLint # Is checked by nolintlint with excluding lll much easier
goheader:
values:
regexp:
# As long we decide which format of YEAR in copyright we want, add this hack
our_year: 202[0-4] # Just change to 202[2-3] or other when changed
template: |-
Copyright (c) {{OUR_YEAR}} IndyKite
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
nakedret:
max-func-lines: 8 # Counting also declaration, not just body
nolintlint:
allow-no-explanation: [lll]
require-explanation: true
require-specific: true
exhaustive:
check:
- switch
- map
default-signifies-exhaustive: true
revive:
# When listed some additional rules, it overrides defaults as well.
# Put manually all default ones from https://github.com/mgechev/revive/blob/master/defaults.toml
rules:
# Default ones sorted as are in defaults.toml
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: empty-block
- name: error-naming
- name: error-return
- name: error-strings
- name: errorf
- name: exported
- name: increment-decrement
- name: indent-error-flow
- name: package-comments
- name: range
- name: receiver-naming
- name: redefines-builtin-id
- name: superfluous-else
- name: time-naming
- name: unexported-return
- name: unreachable-code
- name: unused-parameter
- name: var-declaration
- name: var-naming
# Extra ones
- name: atomic
- name: bare-return
- name: bool-literal-in-expr
- name: comment-spacings
- name: confusing-naming
- name: confusing-results
- name: constant-logical-expr
- name: datarace
- name: deep-exit
- name: defer
- name: duplicated-imports
- name: early-return
- name: empty-lines
- name: get-return
- name: identical-branches
- name: if-return
- name: import-alias-naming
arguments:
- ^([a-z][a-z0-9]{0,}|\.)$
- name: import-shadowing
- name: modifies-parameter
- name: modifies-value-receiver
- name: nested-structs
- name: optimize-operands-order
- name: range-val-address
- name: range-val-in-closure
- name: redundant-import-alias
- name: string-of-int
- name: struct-tag
- name: time-equal
- name: unchecked-type-assertion
- name: unconditional-recursion
- name: unexported-naming
- name: unhandled-error # It is OK not to check errors from some specific cases
arguments:
- fmt.Println
- name: unnecessary-stmt
- name: unused-receiver
- name: use-any
- name: useless-break
- name: waitgroup-by-value
usestdlibvars:
default-rpc-path: true
os-dev-null: true
sql-isolation-level: true
issues:
exclude-use-default: false # Some rules are excluded by GolangCI Linter by default, this one will prevent that
max-issues-per-linter: 0
max-same-issues: 0
exclude-rules:
- linters:
- revive
text: exported .* should have comment .*or be unexported # TODO fix this for proper documentation
- linters:
- revive
- gocritic
text: 'deep-exit: calls to log.Fatalf|exitAfterDefer: log.Fatalf will exit'
path: .*_test.go
# We want to allow import gomega and ginkgo (+ all sub-packages) in tests files only
- linters:
- revive
text: '^dot-imports:'
source: . "github.com/onsi/(gomega|ginkgo)(/.*)?"
path: .*_test.go