Skip to content

Commit acb7fe4

Browse files
committed
chore: upgrade linter
1 parent cb04e44 commit acb7fe4

File tree

3 files changed

+112
-124
lines changed

3 files changed

+112
-124
lines changed

.golangci.yml

Lines changed: 110 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,125 @@
1-
linters-settings:
2-
gosec:
3-
excludes:
4-
- G115 # Annoying and have a lot of false-positive results.
5-
govet:
6-
enable:
7-
- shadow
8-
gocyclo:
9-
min-complexity: 15
10-
dupl:
11-
threshold: 120
12-
goconst:
13-
min-len: 2
14-
min-occurrences: 3
15-
misspell:
16-
locale: US
17-
lll:
18-
line-length: 140
19-
goimports:
20-
local-prefixes: github.com/ClickHouse/ch-go
21-
gocritic:
22-
enabled-tags:
23-
- diagnostic
24-
- experimental
25-
- opinionated
26-
- performance
27-
- style
28-
disabled-checks:
29-
- hugeParam
30-
- rangeValCopy
31-
- exitAfterDefer
32-
- whyNoLint
33-
- singleCaseSwitch
34-
- commentedOutCode
35-
- appendAssign
36-
- unnecessaryBlock
37-
- redundantSprint
38-
- octalLiteral
39-
- ifElseChain
40-
revive:
41-
rules:
42-
- name: unused-parameter
43-
disabled: true
44-
1+
version: "2"
452
linters:
46-
disable-all: true
3+
default: none
474
enable:
485
- dogsled
496
- errcheck
507
- goconst
518
- gocritic
52-
- gofmt
53-
- goimports
54-
- revive
559
- gosec
56-
- gosimple
5710
- govet
5811
- ineffassign
5912
- misspell
6013
- nakedret
14+
- revive
6115
- staticcheck
62-
- stylecheck
63-
- typecheck
6416
- unconvert
6517
- unparam
6618
- whitespace
67-
68-
# Do not enable:
69-
# - wsl (too opinionated about newlines)
70-
# - godox (todos are OK)
71-
# - bodyclose (false positives on helper functions)
72-
# - prealloc (not worth it in scope of this project)
73-
# - maligned (same as prealloc)
74-
# - funlen (gocyclo is enough)
75-
# - gochecknoglobals (we know when it is ok to use globals)
76-
# - depguard (broken)
77-
78-
issues:
79-
exclude-use-default: false
80-
exclude-rules:
81-
# Document when API is stable
82-
- text: "should have comment"
83-
linters: [revive]
84-
85-
# Disable linters that are annoying in tests.
86-
- path: _test\.go
87-
linters:
88-
- gocyclo
89-
- errcheck
90-
- dupl
91-
- gosec
92-
- funlen
93-
- goconst
94-
- gocognit
95-
- scopelint
96-
- lll
97-
98-
# Disable linters that are not needed for testing infra.
99-
- path: internal/cht
100-
linters: [gosec]
101-
102-
- path: _test\.go
103-
text: "Combine"
104-
linters: [gocritic]
105-
106-
# Check that equal to self is true
107-
- linters: [gocritic]
108-
source: "(assert|require).+Equal"
109-
text: "dupArg"
110-
path: _test\.go
111-
112-
# Ignore shadowing of err.
113-
- linters: [govet]
114-
text: 'declaration of "(err|ctx|log|lg|c)"'
115-
116-
# Probably some broken linter for generics?
117-
- linters: [revive]
118-
text: 'receiver-naming: receiver name \S+ should be consistent with previous receiver name \S+ for invalid-type'
119-
120-
# Ignore linters in main packages.
121-
- path: main\.go
122-
linters: [goconst, funlen, gocognit, gocyclo]
123-
124-
- path: main\.go
125-
linters: [gosec]
126-
text: "G307"
127-
128-
- source: 'func Fuzz.+\(f \*testing\.F\)'
129-
linters: [stylecheck]
130-
text: "ST1003" # underscores lol
131-
132-
- path: (internal|cmd)
133-
linters: [revive]
134-
text: "package-comments"
135-
136-
- linters: [revive]
137-
text: "comment on exported const .+ should be of the form"
19+
settings:
20+
dupl:
21+
threshold: 120
22+
goconst:
23+
min-len: 2
24+
min-occurrences: 3
25+
gocritic:
26+
disabled-checks:
27+
- hugeParam
28+
- rangeValCopy
29+
- exitAfterDefer
30+
- whyNoLint
31+
- singleCaseSwitch
32+
- commentedOutCode
33+
- appendAssign
34+
- unnecessaryBlock
35+
- redundantSprint
36+
- octalLiteral
37+
- ifElseChain
38+
enabled-tags:
39+
- diagnostic
40+
- experimental
41+
- opinionated
42+
- performance
43+
- style
44+
gocyclo:
45+
min-complexity: 15
46+
gosec:
47+
excludes:
48+
- G115
49+
govet:
50+
enable:
51+
- shadow
52+
lll:
53+
line-length: 140
54+
misspell:
55+
locale: US
56+
revive:
57+
rules:
58+
- name: unused-parameter
59+
disabled: true
60+
exclusions:
61+
generated: strict
62+
rules:
63+
- linters:
64+
- revive
65+
text: should have comment
66+
- linters:
67+
- dupl
68+
- errcheck
69+
- funlen
70+
- gocognit
71+
- goconst
72+
- gocyclo
73+
- gosec
74+
- lll
75+
- scopelint
76+
path: _test\.go
77+
- linters:
78+
- gosec
79+
path: internal/cht
80+
- linters:
81+
- gocritic
82+
path: _test\.go
83+
text: Combine
84+
- linters:
85+
- gocritic
86+
path: _test\.go
87+
text: dupArg
88+
source: (assert|require).+Equal
89+
- linters:
90+
- govet
91+
text: declaration of "(err|ctx|log|lg|c)"
92+
- linters:
93+
- revive
94+
text: 'receiver-naming: receiver name \S+ should be consistent with previous receiver name \S+ for invalid-type'
95+
- linters:
96+
- funlen
97+
- gocognit
98+
- goconst
99+
- gocyclo
100+
path: main\.go
101+
- linters:
102+
- gosec
103+
path: main\.go
104+
text: G307
105+
- linters:
106+
- staticcheck
107+
text: ST1003
108+
source: func Fuzz.+\(f \*testing\.F\)
109+
- linters:
110+
- revive
111+
path: (internal|cmd)
112+
text: package-comments
113+
- linters:
114+
- revive
115+
text: comment on exported const .+ should be of the form
116+
formatters:
117+
enable:
118+
- gofmt
119+
- goimports
120+
settings:
121+
goimports:
122+
local-prefixes:
123+
- github.com/ClickHouse/ch-go
124+
exclusions:
125+
generated: strict

internal/ztest/logger_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func (t *testLogSpy) Logf(format string, args ...interface{}) {
173173
m := fmt.Sprintf(format, args...)
174174
m = m[strings.IndexByte(m, '\t')+1:]
175175
t.Messages = append(t.Messages, m)
176-
t.TB.Log(m)
176+
t.Log(m)
177177
}
178178

179179
func (t *testLogSpy) AssertMessages(msgs ...string) {

proto/proto_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type staticAware struct {
2323
}
2424

2525
func (s staticAware) Decode(r *Reader) error {
26-
return s.AwareDecoder.DecodeAware(r, Version)
26+
return s.DecodeAware(r, Version)
2727
}
2828

2929
func aware(v AwareDecoder) Decoder {

0 commit comments

Comments
 (0)