-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.golangci.yml
More file actions
214 lines (184 loc) · 4.27 KB
/
.golangci.yml
File metadata and controls
214 lines (184 loc) · 4.27 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"
linters:
default: all
disable:
# No restrictions on packages
- depguard
# overly strict
- exhaustruct
# Use named returns when it makes sense
- nonamedreturns
# Favor inline errors
- noinlineerr
# Deprecated
- wsl
- gomodguard
# Occasional dynamic errors are fine
- err113
# Most errors don't need additional wrapping
- wrapcheck
# Used wherever it makes sense
- dogsled
# Requires too many exceptions
- varnamelen
# Project uses dashes for tags
- tagliatelle
# Tags are not always necessary
- musttag
# Can introduce unintentional behavior
- recvcheck
# Returning interfaces is not inherently wrong or bad
- ireturn
# Not in scope for this project
- goprintffuncname
settings:
revive:
rules:
- name: var-naming
arguments:
- ["ID"] # allow list (keep if you want)
- [] # deny list
- - skip-initialism-name-checks: true
upper-case-const: true
skip-package-name-checks: true
skip-package-name-collision-with-go-std: true
wsl_v5:
allow-first-in-block: false
allow-whole-block: false
# branch-max-lines: 4
# case-max-lines: 2
default: all
cyclop:
max-complexity: 35
package-average: 15
errcheck:
check-type-assertions: true
forbidigo:
forbid:
# Encourage using loggers instead of fmt.Print*
- pattern: fmt\.Print.*
# Discourage exiting the program
- pattern: os.Exit
- pattern: log.Fatal.*
funlen:
lines: 100
statements: 50
ignore-comments: true
gocognit:
min-complexity: 20
govet:
enable-all: true
disable:
- fieldalignment
inamedparam:
skip-single-param: true
ireturn:
allow:
- anon
- error
- empty
- stdlib
- generic
mnd:
ignored-functions:
- args.Error
- flag.Arg
- flag.Duration.*
- flag.Float.*
- flag.Int.*
- flag.Uint.*
- os.Chmod
- os.Mkdir.*
- os.OpenFile
- os.WriteFile
- time.Duration
nakedret:
max-func-lines: 0
nolintlint:
require-explanation: true
require-specific: true
allow-no-explanation:
- funlen
- gocognit
- lll
usetesting:
os-temp-dir: true
varnamelen:
ignore-names:
- tc
- ok
exclusions:
generated: lax
rules:
- linters:
- funlen
- wrapcheck
- dupl
- gocognit
- goconst
path: _test.go
# Exceptions for `main.go` and `config.go`
- linters:
- forbidigo
path: ^cmd/.+/(main|config)\.go$
- linters:
- forbidigo
path: main.go$
- linters:
- forbidigo
path: internal/cli
# Ignore varnamelen for test files
- linters:
- varnamelen
path: _test.go$
# EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
- path: (.+)\.go$
text: Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked
- linters:
- govet
text: 'shadow: declaration of "(err|ctx)" shadows declaration at'
paths:
- third_party$
- builtin$
- examples$
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
- golines
settings:
gci:
sections:
# std
- standard
# extensions
- prefix(golang.org)
# 3rd party
- prefix(github.com)
# custom
- prefix(github.com/idelchi)
- default
custom-order: true
gofmt:
rewrite-rules:
- pattern: "interface{}"
replacement: "any"
- pattern: "a[b:len(a)]"
replacement: "a[b:]"
gofumpt:
extra-rules: true
golines:
max-len: 120
shorten-comments: true
reformat-tags: false
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$