11version : " 2"
22run :
33 tests : true
4+
45linters :
56 default : none
67 enable :
@@ -15,6 +16,7 @@ linters:
1516 - revive
1617 - staticcheck
1718 - unused
19+
1820 settings :
1921 errcheck :
2022 exclude-functions :
@@ -66,24 +68,10 @@ linters:
6668 require-specific : true
6769 # require comments like "//nolint:errcheck // Explanation of why we are ignoring linter here..."
6870 require-explanation : true
71+
6972 exclusions :
7073 generated : lax
7174 rules :
72- - linters :
73- - unused
74- path : cmd/algofix/
75- - linters :
76- - unused
77- path : cmd/algocfg/
78- - linters :
79- - unused
80- path : cmd/catchpointdump/
81- - linters :
82- - unused
83- path : tools/
84- - linters :
85- - unused
86- path : daemon/kmd/lib/kmdapi/
8775 - linters :
8876 - errcheck
8977 - ineffassign
@@ -94,98 +82,72 @@ linters:
9482 path : _test\.go
9583 - linters :
9684 - staticcheck
97- path : _test\.go
98- text : ' SA4006: this value'
99- - linters :
100- - staticcheck
101- text : ' (SA3001|SA1019):'
85+ text : ' SA3001:' # we assign to b.N in several benchmarks
10286 - linters :
10387 - revive
10488 path : _test\.go
105- text : ' dot-imports: should not use dot imports'
89+ text : ' dot-imports: should not use dot imports' # dot imports OK for tests
10690 - linters :
10791 - staticcheck
108- text : ' SA1019: rand*'
109- # QF1008: suggests removing embedded field names from selectors (e.g., txn.SignedTxn.Txn -> txn.Txn)
110- # We prefer explicit embedded field access for clarity with transaction types and other embedded structs
92+ text : ' SA1019: rand*' # XXX should fix, in Go 1.24 rand.Seed() is a no-op
11193 - linters :
11294 - staticcheck
113- text : ' QF1008:'
114- # ST1005: error strings should not be capitalized
95+ text : ' QF1008:' # ignore suggestions to remove embedded fields (e.g., txn.SignedTxn.Txn -> txn.Txn)
11596 - linters :
11697 - staticcheck
117- text : ' ST1005:'
118- # QF1001: De Morgan's law suggestions
98+ text : ' ST1005:' # ignore "error strings should not be capitalized"
11999 - linters :
120100 - staticcheck
121- text : ' QF1001:'
122- # QF1003: tagged switch suggestions
101+ text : ' QF1001:' # ignore De Morgan's law suggestions
123102 - linters :
124103 - staticcheck
125- text : ' QF1003:'
126- # revive: util is an acceptable package name in this codebase
104+ text : ' QF1003:' # ignore suggestions to replace if/else chain with switch
127105 - linters :
128106 - revive
129107 path : util/
130- text : ' var-naming: avoid meaningless package names'
131- # allow shadowing in test code
108+ text : ' var-naming: avoid meaningless package names' # util package is OK
132109 - linters :
133110 - govet
134111 path : _test\.go
135- text : shadows declaration at line
136- # Ignore missing parallel tests in existing packages
112+ text : shadows declaration at line # allow shadowing in test code
137113 - linters :
138- - paralleltest
114+ - paralleltest # Ignore missing t.Parallel calls in the following packages
139115 path : ^(agreement|catchup|config|crypto|daemon|data|gen|ledger|logging|network|node|protocol|rpcs|stateproof|test|tools|util).*_test\.go
140- # Add all linters here -- Comment this block out for testing linters
141116 - linters :
142- - errcheck
143- - govet
144- - ineffassign
145- - misspell
146- - revive
147- - unused
148- path : test/linttest/lintissues\.go
149- # ignore govet false positive fixed in https://github.com/golang/go/issues/45043
150- - path : (.+)\.go$
151- text : ' sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify'
152- # ignore golint false positive fixed in https://github.com/golang/lint/pull/487
153- - path : (.+)\.go$
154- text : exported method (.*).Unwrap` should have comment or be unexported
155- # ignore issues about the way we use _struct fields to define encoding settings
156- - path : (.+)\.go$
157- text : ' field _struct is unused'
158- linters :
159117 - unused
118+ text : ' field _struct is unused' # we use _struct field tags for msgp/json encoding settings
119+
160120 # Enable some golangci-lint default exception rules:
161121 # "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok"
162122 - path : (.+)\.go$
163123 text : Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
164- # "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore"
165- - path : (.+)\.go$
166- text : ineffective break statement. Did you mean to break out of the outer loop
167- # revive: irrelevant error about naming
168- - path : (.+)\.go$
169- text : ' ^var-naming: don'' t use leading k in Go names'
170124 # revive: ignore unused-paramter, package-comments, unexported-return, redefines-builtin-id, var-declaration, empty-block, superfluous-else
171125 - path : (.+)\.go$
172126 text : ' ^unused-parameter: parameter'
173127 - path : (.+)\.go$
174128 text : ' ^package-comments: should have a package comment'
175129 - path : (.+)\.go$
176- text : ' ^unexported-return: '
130+ text : ' ^unexported-return: exported func .* returns unexported type .*, which can be annoying '
177131 - path : (.+)\.go$
178- text : ' ^redefines-builtin-id: redefinition of'
132+ text : ' ^redefines-builtin-id: redefinition of the built-in (func|type) '
179133 - path : (.+)\.go$
180- text : ' ^var-declaration: should'
134+ text : ' ^var-declaration: should omit type .* from declaration of var .*; it will be inferred from the right-hand side'
135+ - path : (.+)\.go$
136+ text : ' ^var-declaration: should drop .* from declaration of var .*; it is the zero value'
181137 - path : (.+)\.go$
182138 text : ' ^empty-block: this block is empty, you can remove it'
183139 - path : (.+)\.go$
184- text : ' ^superfluous-else: if block ends with'
185- paths :
186- - third_party$
187- - builtin$
188- - examples$
140+ text : ' ^superfluous-else: if block ends with .* so drop this else and outdent its block'
141+ # Comment this block out for testing linters
142+ - linters :
143+ - errcheck
144+ - govet
145+ - ineffassign
146+ - misspell
147+ - revive
148+ - unused
149+ path : test/linttest/lintissues\.go
150+
189151issues :
190152 # Work our way back over time to be clean against all these
191153 # checkers. If you'd like to contribute, raise the number after ~,
@@ -199,13 +161,11 @@ issues:
199161 max-same-issues : 0
200162severity :
201163 default : error
164+
202165formatters :
203166 enable :
204167 - gofmt
205168 exclusions :
206169 generated : lax
207170 paths :
208- - third_party$
209- - builtin$
210- - examples$
211171 - test/linttest/lintissues\.go
0 commit comments