-
Notifications
You must be signed in to change notification settings - Fork 227
Expand file tree
/
Copy path.golangci.yml
More file actions
153 lines (153 loc) · 4.69 KB
/
Copy path.golangci.yml
File metadata and controls
153 lines (153 loc) · 4.69 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
version: "2"
issues:
# Maximum issues count per one linter.
# Set to 0 to disable - unlimited.
# Default: 50
max-issues-per-linter: 0
# Maximum count of issues with the same text.
# Set to 0 to disable - unlimited.
# Default: 3
max-same-issues: 0
linters:
default: all
disable:
- copyloopvar # replaced exportloopref, but we don't need it for Go 1.22+
- dupl # we can't avoid duplicating code
- err113 # extra work & poor benefit (renamed from goerr113)
- exhaustruct # too many files to fix/nolint
- funlen # useless
- funcorder # too many so far
- gochecknoglobals # mostly useless
- gochecknoinits # we use init functions
- gocyclo # using cyclop with the max 30 instead
- goconst # too annoying
- godox # we sometimes leave TODOS right in the code
- gomoddirectives # we use replace directives
- gomodguard # deprecated
- nlreturn # too annoying
- paralleltest
- protogetter # we need direct access to proto fields
- rowserrcheck # disabled because of generics
- tagalign
- varnamelen # useless
- wastedassign # disabled because of generics
- wrapcheck # we do not use wrapping everywhere
- wsl # too annoying
- wsl_v5 # too annoying
settings:
cyclop:
max-complexity: 30
depguard:
rules:
main:
deny:
- pkg: github.com/pkg/errors
desc: use "errors" instead
- pkg: github.com/gogo/protobuf/proto
desc: use "github.com/golang/protobuf/proto" instead
- pkg: github.com/percona/go-mysql/log/slow
desc: only use the forked parser
- pkg: github.com/percona/saas
desc: use "github.com/percona/platform" instead
- pkg: gopkg.in/yaml.v2
desc: use "gopkg.in/yaml.v3" instead
exhaustive:
default-signifies-exhaustive: true
godot:
scope: toplevel
exclude:
- go-sumtype:decl
- pmm-managed
capital: true
period: true
inamedparam:
skip-single-param: true
ireturn:
allow:
- anon
- error
- empty
- stdlib
- github.com/percona/pmm/admin/commands.Result
- github.com/percona/pmm/agent/runner/actions.Action
- github.com/percona/pmm/managed/services/telemetry.DataSource
lll:
line-length: 170
tab-width: 4
maintidx:
under: 20
nestif:
min-complexity: 7
recvcheck:
exclusions:
- '*.pb.go'
- '*_test.go'
- mock_*.go
- '*_reform.go'
tagliatelle:
case:
rules:
avro: snake
bson: camel
json: ""
xml: camel
yaml: ""
unparam:
check-exported: true
exclusions:
generated: lax
rules:
- linters:
- contextcheck # not critical, too many things to disable
- errcheck # not critical, too many things to disable
- exhaustivestruct # very annoying
- forcetypeassert # for tests' brevity sake
- funlen # tests may be long
- gocognit # triggered by subtests
- gosec # not critical, too many things to disable
- ireturn # we have exceptions, so need to silence them in tests
- lll # tests often require long lines
- maintidx # not critical for tests
- mnd # tests are full of magic numbers
- nonamedreturns # not critical for tests, albeit desirable
- testpackage # senseless
- unused # very annoying false positive: https://github.com/golangci/golangci-lint/issues/791
- unusedwrite # not critical for tests
path: _test\.go
- linters:
- recvcheck
path: managed/models/
- linters:
- mnd
path: api-tests
paths:
- managed/utils/interceptors/go-grpc-prometheus.go
- agent/agents/mongodb/internal/
- qan-api2/migrations/
- third_party$
- builtin$
- examples$
- ui/
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
settings:
gci:
sections:
- standard
- default
- prefix(github.com/percona/pmm)
goimports:
local-prefixes:
- github.com/percona/pmm
exclusions:
generated: lax
paths:
- agent/agents/mongodb/internal/
- qan-api2/migrations/
- third_party$
- builtin$
- examples$