-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
200 lines (167 loc) · 5.2 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
# List the available linters:
# go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest linters --no-config
# Run the last version:
# go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run
# Documentation:
# https://golangci-lint.run/usage/configuration/#run-configuration
---
run:
# exit code when at least one issue was found, default is 1
issues-exit-code: 1
# which dirs to skip: they won't be analyzed;
# can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but next dirs are always skipped independently
# from this option's value:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs:
- vendor
- poc
go: "1.17"
# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 10m
linters:
enable-all: true
disable:
# DEPRECATED
- exhaustivestruct
- golint
- interfacer
- maligned
- scopelint
# ANNOYING
- exhaustruct
- gci
- goerr113
- nlreturn
- varnamelen
- wrapcheck
- wsl
linters-settings:
dupl:
threshold: 94
funlen:
lines: 100
statements: 50
gocyclo:
min-complexity: 17
cyclop:
max-complexity: 18
gci:
sections: [prefix(github.com/teal-finance/)]
goconst:
min-len: 2
min-occurrences: 5
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- captLocal
- unnamedResult
# - dupImport # https://github.com/go-critic/go-critic/issues/845
# - ifElseChain
# - octalLiteral
# - whyNoLint
# - wrapperFunc
# - yodaStyleExpr
# - singleCaseSwitch # Every time this occurred in the code, there was no other way.
# https://github.com/mvdan/gofumpt
gofumpt:
lang-version: "1.22"
extra-rules: true
goimports:
local-prefixes: github.com/teal-finance/
golint:
min-confidence: 0
gomnd:
settings:
mnd:
# don't include the "operation" and "assign,argument,case,condition"
checks: [return]
govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
lll:
line-length: 160
maligned:
suggest-new: true
misspell:
locale: US
nolintlint:
allow-leading-space: false # don't require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: true # don't require nolint directives to be specific about which linter is being skipped
gosimple:
go: "1.22"
# https://staticcheck.io/docs/options#checks
checks: ["all"]
staticcheck:
go: "1.22"
# https://staticcheck.io/docs/options#checks
checks: ["all"]
stylecheck:
go: "1.22"
# https://staticcheck.io/docs/options#checks
checks: ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022"]
# https://staticcheck.io/docs/options#dot_import_whitelist
dot-import-whitelist:
- fmt
# https://staticcheck.io/docs/options#initialisms
initialisms: ["ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS"]
# https://staticcheck.io/docs/options#http_status_code_whitelist
http-status-code-whitelist: ["200", "400", "404", "500"]
tagliatelle:
case:
rules:
json: snake # could be "goCamel"
# https://github.com/butuzov/ireturn
# https://golangci-lint.run/usage/linters/#ireturn
ireturn:
allow:
- anon # anonymous interfaces such as: interface{Stop()}
- error # error interface
- stdlib # standard library interfaces
- github.com/prometheus\/client_golang\/prometheus.Gauge
- github.com/prometheus\/client_golang\/prometheus.Counter
issues:
exclude-rules:
# Excluding configuration per-path
- path: _test\.go
linters:
# gomnd
- gosec # weak random number generator (math/rand instead of crypto/rand)
- scopelint
# gocyclo
# errcheck
# dupl
# unparam
# staticcheck
# Excluding configuration per-linter
- linters:
- gocritic
text: "unnecessaryDefer:"
# Excluding configuration per-text and per-source
- text: "exitAfterDefer:"
linters:
- gocritic
output:
# colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number"
format: colored-line-number
# print lines of code with issue, default is true
print-issued-lines: true
# print linter name in the end of issue text, default is true
print-linter-name: true
# make issues output unique by line, default is true
uniq-by-line: true
# sorts results by: filepath, line and column
sort-results: true