-
Notifications
You must be signed in to change notification settings - Fork 474
/
.golangci.yml
218 lines (208 loc) · 7.5 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
run:
timeout: 5m
tests: true
linters:
# default: deadcode, errcheck, gosimple, govet, ineffassign, staticcheck, typecheck, unused, varcheck
disable-all: true
enable:
- errcheck
- copyloopvar
- gofmt
- gosimple
- govet
- ineffassign
- misspell
- nilerr
- nolintlint
- revive
- staticcheck
- typecheck
- paralleltest
- unused
severity:
default-severity: error
linters-settings:
nolintlint:
# require naming a specific linter X using //nolint:X
require-specific: true
# require comments like "//nolint:errcheck // Explanation of why we are ignoring linter here..."
require-explanation: true
errcheck:
exclude-functions:
# We do this 121 times and never check the error.
- (*github.com/spf13/cobra.Command).MarkFlagRequired
- (*github.com/spf13/pflag.FlagSet).MarkDeprecated
- (*github.com/spf13/pflag.FlagSet).MarkShorthandDeprecated
govet:
# Enables these linters in addition to the default ones.
enable:
- shadow
settings:
shadow:
# explanation of strict vs non-strict:
# https://github.com/golang/tools/blob/v0.7.0/go/analysis/passes/shadow/shadow.go#L104-L122
strict: false
printf:
# Comma-separated list of print function names to check (in addition to default, see `go tool vet help printf`).
# Default: []
funcs:
- (github.com/algorand/go-algorand/logging.Logger).Debugf
- (github.com/algorand/go-algorand/logging.Logger).Infof
- (github.com/algorand/go-algorand/logging.Logger).Warnf
- (github.com/algorand/go-algorand/logging.Logger).Errorf
- (github.com/algorand/go-algorand/logging.Logger).Fatalf
- (github.com/algorand/go-algorand/logging.Logger).Panicf
- (github.com/algorand/go-algorand/logging.Logger).Debugln
- (github.com/algorand/go-algorand/logging.Logger).Infoln
- (github.com/algorand/go-algorand/logging.Logger).Warnln
- (github.com/algorand/go-algorand/logging.Logger).Errorln
- (github.com/algorand/go-algorand/logging.Logger).Fatalln
- (github.com/algorand/go-algorand/logging.Logger).Panicln
- (github.com/algorand/go-algorand/logging.Logger).Debug
- (github.com/algorand/go-algorand/logging.Logger).Info
- (github.com/algorand/go-algorand/logging.Logger).Warn
- (github.com/algorand/go-algorand/logging.Logger).Error
- (github.com/algorand/go-algorand/logging.Logger).Fatal
- (github.com/algorand/go-algorand/logging.Logger).Panic
- (github.com/algorand/go-algorand/cmd/goal/main).reportInfof
- (github.com/algorand/go-algorand/cmd/goal/main).reportInfoln
- (github.com/algorand/go-algorand/cmd/goal/main).reportWarnf
- (github.com/algorand/go-algorand/cmd/goal/main).reportWarnln
- (github.com/algorand/go-algorand/cmd/goal/main).reportWarnRawf
- (github.com/algorand/go-algorand/cmd/goal/main).reportWarnRawln
- (github.com/algorand/go-algorand/cmd/goal/main).reportErrorf
- (github.com/algorand/go-algorand/cmd/goal/main).reportErrorln
issues:
# Work our way back over time to be clean against all these
# checkers. If you'd like to contribute, raise the number after ~,
# run the linter and dig in.
new-from-rev: eb019291beed556ec6ac1ceb4a15114ce4df0c57~25
# Disable default exclude rules listed in `golangci-lint run --help` (selectively re-enable some below)
exclude-use-default: false
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0
exclude:
# ignore govet false positive fixed in https://github.com/golang/go/issues/45043
- "sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify"
# ignore golint false positive fixed in https://github.com/golang/lint/pull/487
- "exported method (.*).Unwrap` should have comment or be unexported"
# ignore issues about the way we use _struct fields to define encoding settings
- "`_struct` is unused"
# Enable some golangci-lint default exception rules:
# "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok"
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
# "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore"
- ineffective break statement. Did you mean to break out of the outer loop
# revive: irrelevant error about naming
- "^var-naming: don't use leading k in Go names"
# revive: ignore unused-paramter, package-comments, unexported-return, redefines-builtin-id, var-declaration, empty-block, superfluous-else
- "^unused-parameter: parameter"
- "^package-comments: should have a package comment"
- "^unexported-return: "
- "^redefines-builtin-id: redefinition of"
- "^var-declaration: should"
- "^empty-block: this block is empty, you can remove it"
- "^superfluous-else: if block ends with"
exclude-rules:
- path: cmd/algofix/
linters: unused
- path: cmd/algocfg/
linters: unused
- path: cmd/catchpointdump/
linters: unused
- path: tools/
linters: unused
- path: _test\.go
linters:
- errcheck
# - gofmt
- gosimple
# - govet
- ineffassign
- misspell
# - nilerr
- nolintlint
# - revive
# - staticcheck
- typecheck
- unused
- path: _test\.go
linters:
- staticcheck
text: "SA4006: this value" # of X is never used
- path: _test\.go
linters:
- revive
text: "dot-imports: should not use dot imports"
- linters:
- staticcheck
text: "SA1019: rand*"
# allow shadowing in test code
- path: _test\.go
linters:
- govet
text: "shadows declaration at line"
# Ignore missing parallel tests in existing packages
- path: ^agreement.*_test\.go
linters:
- paralleltest
- path: ^catchup.*_test\.go
linters:
- paralleltest
- path: ^config.*_test\.go
linters:
- paralleltest
- path: ^crypto.*_test\.go
linters:
- paralleltest
- path: ^daemon.*_test\.go
linters:
- paralleltest
- path: ^data.*_test\.go
linters:
- paralleltest
- path: ^gen.*_test\.go
linters:
- paralleltest
- path: ^ledger.*_test\.go
linters:
- paralleltest
- path: ^logging.*_test\.go
linters:
- paralleltest
- path: ^network.*_test\.go
linters:
- paralleltest
- path: ^node.*_test\.go
linters:
- paralleltest
- path: ^protocol.*_test\.go
linters:
- paralleltest
- path: ^rpcs.*_test\.go
linters:
- paralleltest
- path: ^stateproof.*_test\.go
linters:
- paralleltest
- path: ^test.*_test\.go
linters:
- paralleltest
- path: ^tools.*_test\.go
linters:
- paralleltest
- path: ^util.*_test\.go
linters:
- paralleltest
# Add all linters here -- Comment this block out for testing linters
- path: test/linttest/lintissues\.go
linters:
- errcheck
- gofmt
- revive
- govet
- ineffassign
- misspell
- unused