forked from Broadcom/kopia
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.golangci.yml
More file actions
201 lines (196 loc) · 5.33 KB
/
.golangci.yml
File metadata and controls
201 lines (196 loc) · 5.33 KB
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
version: "2"
linters:
settings:
cyclop:
max-complexity: 20
depguard:
rules:
main:
deny:
# v2 of the SDK comprises many modules, which means it cannot be
# denied with a single gomodguard entry
- pkg: "github.com/aws/aws-sdk-go-v2"
desc: "use github.com/minio/minio-go"
exhaustive:
# indicates that switch statements are to be considered exhaustive if a
# 'default' case is present, even if all enum members aren't listed in the
# switch
default-signifies-exhaustive: true
forbidigo:
forbid:
- pattern: filepath.IsAbs # use ospath.IsAbs which supports windows UNC paths
- pattern: time.Now # do not use outside of 'clock' and 'timetrack' packages use clock.Now or timetrack.StartTimer
- pattern: time.Since # use timetrack.Timer.Elapsed()
- pattern: time.Until # never use this
- pattern: Envar\(\" # do not use envar literals, always wrap with EnvName()
funlen:
lines: 100
statements: 60
gocognit:
min-complexity: 40
gomodguard:
blocked:
modules:
- github.com/aws/aws-sdk-go:
recommendations:
- github.com/minio/minio-go
reason: "github.com/aws/aws-sdk-go is not actively developed any longer"
- github.com/rs/zerolog/log:
recommendations:
- "use kopia's logging packages"
reason: "zerolog not currently use"
- go.uber.org/multierr:
recommendations:
- errors
reason: "multierr.Append() can be replaced by native errors.Join()"
goconst:
min-len: 5
min-occurrences: 3
gocritic:
settings:
hugeParam:
# size in bytes that makes the warning trigger (default 80)
sizeThreshold: 160
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- whyNoLint
- wrapperFunc
gocyclo:
min-complexity: 15
govet:
enable-all: true
settings:
printf:
funcs:
- (*go.uber.org/zap.SugaredLogger).Debugf
- (*go.uber.org/zap.SugaredLogger).Infof
- (*go.uber.org/zap.SugaredLogger).Warnf
- (*go.uber.org/zap.SugaredLogger).Errorf
lll:
line-length: 256
loggercheck:
zap: true
no-printf-like: true
rules:
- (*go.uber.org/zap.SugaredLogger).With
misspell:
locale: US
modernize:
disable:
- omitzero
wsl_v5:
allow-whole-block: true
default: all
disable:
- embeddedstructfieldcheck
- exhaustruct
- funcorder
- gochecknoglobals
- gochecknoinits
- gosmopolitan
- importas
- ireturn # this one may be interesting to control allocations
- musttag
- nakedret # already enforced by gofumpt in a stricter manner
- nilnil
- nlreturn # already enforced by wsl_v5
- noinlineerr # inline error handling is a common Go idiom used in this codebase
- nonamedreturns
- paralleltest
- prealloc
- protogetter
- rowserrcheck
- sqlclosecheck
- tagalign
- tagliatelle
- testpackage
- tparallel
- usetesting
- varnamelen # this one may be interesting, but too much churn
- whitespace
- wsl
- zerologlint # zerolog not currently used in the codebase
exclusions:
generated: lax
rules:
- path: _test\.go|testing|tests|test_env|fshasher|fault
linters:
- contextcheck
- errcheck
- errchkjson
- funlen
- gochecknoglobals
- gocognit
- goconst
- gosec
- mnd
- musttag
- nestif
- nolintlint
- perfsprint
- revive
- wrapcheck
- text: "Magic number: 1e"
linters:
- mnd
- text: "filepathJoin"
linters:
- gocritic
- text: "weak cryptographic primitive"
linters:
- gosec
- text: "lines are duplicate of"
linters:
- dupl
- text: "Line contains TODO"
linters:
- godox
- text: "error returned from external package is unwrapped: sig: func github.com/kopia/kopia/internal/retry"
linters:
- wrapcheck
- text: "error returned from external package is unwrapped: sig: func github.com/kopia/kopia/internal/connection.UsingConnection"
linters:
- wrapcheck
- text: "Errors unhandled"
linters:
- gosec
- text: "unwrapped: sig: func github.com/kopia/kopia/fs.GetAllEntries"
linters:
- wrapcheck
- text: "float-compare: use require.InEpsilon"
linters:
- testifylint
- text: "fieldalignment:"
linters:
- govet
- text: "shadow:"
linters:
- govet
- text: "unnamedResult:"
linters:
- gocritic
- linters:
- cyclop
path: (.+)_test\.go
warn-unused: true
formatters:
enable:
- gci
- gofumpt
settings:
gci:
sections:
- standard
- default
- localmodule
gofumpt:
extra-rules: true
output:
show-stats: false
run:
timeout: 20m