-
Notifications
You must be signed in to change notification settings - Fork 22
/
.golangci.toml
191 lines (165 loc) · 4.71 KB
/
.golangci.toml
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
[run]
allow-parallel-runners = true
print-linter-name = true
timeout = '15m0s'
skip-dirs = [
'protos',
]
[issues]
max-issues-per-linter = 0
max-same-issues = 0
#new = true
[linters]
enable-all = true
disable = [
"containedctx",
"contextcheck",
"cyclop",
"dogsled",
"dupl",
"errcheck",
"errchkjson",
"errname",
"errorlint",
"exhaustive",
"exhaustivestruct",
"forcetypeassert",
"funlen",
"gochecknoglobals",
"gochecknoinits",
"gocognit",
"goconst",
"gocritic",
"gocyclo",
"godox",
"goerr113",
"goimports",
"gomnd",
"gomoddirectives",
"gosec",
"ifshort",
"interfacebloat",
"ireturn",
"maintidx",
"nestif",
"nilnil",
"nolintlint",
"paralleltest",
"predeclared",
"promlinter",
"stylecheck",
"tagliatelle",
"testpackage",
"tparallel",
"varnamelen",
"wrapcheck",
"wsl",
## New linters, disabled until we evaluate if we want them
"wastedassign",
"nakedret",
"rowserrcheck",
"musttag",
"govet",
"gosmopolitan",
"dupword",
"depguard",
"revive",
## new with 1.55.2, need to evaluate
"testifylint",
"inamedparam",
"perfsprint",
"typecheck",
"protogetter",
## Disabled on-pupose.
"exhaustruct", # We often make incomplete structs.
"lll", # We don't have a line length.
"nlreturn", # Doesn't match our code style.
"nonamedreturns", # We don't mind named returns.
## Deprecated linters.
"deadcode", # Replaced by 'unused'.
"golint", # Replaced by 'revive'.
"interfacer", # Not replaced.
"maligned", # Replaced by 'go vet fieldalignment'.
"nosnakecase", # Replaced by 'revive'.
"scopelint", # Replace by 'looppointer' or 'exportloopref'
"structcheck", # Replaced by 'unused'.
"varcheck", # Replaced by 'unused'.
]
[linters-settings.govet]
enable = [
# "fieldalignment", to enable one day
]
[linters-settings.goheader]
template = """
Copyright (C) 2023 Gobalsky Labs Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>."""
[linters-settings.gci]
custom-order = true
sections = [
"standard", # Standard section: captures all standard packages.
"prefix(code.vegaprotocol.io/vega)", # Custom section: groups all imports with the specified Prefix.
"default", # Default section: contains all imports that could not be matched to another section type.
"blank", # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
"dot",
]
[[issues.exclude-rules]]
linters = ["staticcheck"]
text = "SA1019:"
[[issues.exclude-rules]]
linters = ["staticcheck"]
text = "SA5008:"
[[issues.exclude-rules]]
path = "core/integration/setup_test.go"
linters = ["forbidigo"]
[[issues.exclude-rules]]
path = "core/matching/orderbook_test.go"
linters = ["forbidigo"]
[[issues.exclude-rules]]
path = "cmd/"
linters = ["forbidigo"]
[[issues.exclude-rules]]
path = "vegatools/"
linters = ["forbidigo"]
[[issues.exclude-rules]]
path = "flags.go"
linters = ["forbidigo"]
[[issues.exclude-rules]]
path = "print.go"
linters = ["forbidigo"]
[[issues.exclude-rules]]
path = "libs/json/json.go"
linters = ["forbidigo"]
[[issues.exclude-rules]]
path = "_test.go"
linters = ["exhaustruct", "noctx"]
# Don't complain about context not being first argument in tests (convention is to use *testing.T)
[[issues.exclude-rules]]
paths = ["_test.go", "helpers.go"]
linters = ["revive"]
text = "context-as-argument"
# Don't complain about underscores in test methods.
[[issues.exclude-rules]]
paths = ["_test.go", "helpers.go"]
linters = ["revive"]
text = "var-naming"
[linters-settings.forbidigo]
forbid = ["fmt\\.Print.*"]
# protoc doesn't want us copying protobuf messages because they can have some internal state
# that shouldn't be copied; but we do it a lot. see below for details
# https://stackoverflow.com/questions/64183794/why-do-the-go-generated-protobuf-files-contain-mutex-locks
[[issues.exclude-rules]]
linters = ["govet"]
text = "impl.MessageState contains sync.Mutex"
# Temporary while the test is skipped to be removed.
[[issues.exclude-rules]]
path = "market_cp_restore_test.go"
linters = ["unused"]