forked from kopia/kopia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
181 lines (179 loc) · 4.42 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
linters-settings:
cyclop:
max-complexity: 20
skip-tests: true
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:
- filepath.IsAbs # use ospath.IsAbs which supports windows UNC paths
- ioutil.Discard # use io.Discard
- ioutil.NopCloser # use io.NopCloser
- ioutil.ReadAll # use io.ReadAll
- ioutil.ReadDir # use os.ReadDir
- ioutil.ReadFile # use os.ReadFile
- ioutil.TempDir # use os.MkdirTemp
- ioutil.TempFile # use os.CreateTemp
- ioutil.WriteFile # use os.WriteFile
- time.Now # do not use outside of 'clock' and 'timetrack' packages use clock.Now or timetrack.StartTimer
- time.Since # use timetrack.Timer.Elapsed()
- time.Until # never use this
- Envar\(\" # do not use envar literals, always wrap with EnvName()
funlen:
lines: 100
statements: 60
gci:
sections:
- standard
- default
- prefix(github.com/kopia/kopia)
gocognit:
min-complexity: 40
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
goimports:
local-prefixes: github.com/kopia/kopia
govet:
shadow: 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
maligned:
suggest-new: true
misspell:
locale: US
linters:
enable-all: true
disable:
- depguard
- execinquery
- exhaustruct
- exportloopref
- gochecknoinits
- gomnd
- gci
- ireturn # this one may be interesting to control allocations
- gosmopolitan
- musttag
- nilnil
- nlreturn
- nonamedreturns
- paralleltest
- prealloc
- rowserrcheck
- sqlclosecheck
- tagalign
- tagliatelle
- testpackage
- tparallel
- varnamelen # this one may be interesting, but too much churn
- wastedassign
- whitespace
issues:
exclude-use-default: false
exclude-rules:
- path: \.pb\.go
linters:
- gofmt
- path: reporter.go
linters:
- musttag
- path: _test\.go|testing|tests|test_env|fshasher|fault
linters:
- contextcheck
- errcheck
- errchkjson
- forcetypeassert
- funlen
- gochecknoglobals
- gocognit
- goconst
- mnd
- gosec
- musttag
- nestif
- perfsprint
- revive
- nolintlint
- wrapcheck
- wsl
- text: "log is a global variable"
linters:
- gochecknoglobals
- text: "tracer is a global variable"
linters:
- gochecknoglobals
# always allow ctx even when unused
- text: "unused-parameter: parameter 'ctx' seems to be unused"
linters:
- revive
- text: "Magic number: 1e"
linters:
- mnd
- text: "unnecessaryDefer"
linters:
- gocritic
- 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: timeCmpSimplify
linters:
- gocritic
- text: ".*Magic number\\: [01],"
linters:
- mnd
- 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