forked from redpanda-data/terraform-provider-redpanda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.golangci.yml
177 lines (172 loc) · 4.27 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
run:
allow-parallel-runners: true
skip-dirs:
- proto
# golangci-lint by default ignores some staticcheck and vet raised issues that
# are actually important to catch. The following ensures that we do not ignore
# those tools ever.
issues:
exclude-use-default: false
exclude-rules:
- linters:
- goconst
text: "string `UNSPECIFIED` has"
path: redpanda/utils/utils.go
- linters:
- goconst
text: "string `ANY` has"
path: redpanda/utils/utils.go
- linters:
- goconst
text: "string `UNKNOWN` has"
path: redpanda/utils/utils.go
# We opt out of all suggested linters and manually pick what we want.
# Please do not use enable-all.
linters:
disable-all: true
enable:
# Enabled by default linters:
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
# Disabled by default
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
- cyclop
- decorder
- dupword
- durationcheck
- errname
- errorlint
- exhaustive
- exportloopref
- gci
- gocheckcompilerdirectives
- gocognit
- goconst
- gocritic
- gocyclo
- gofmt
- gofumpt
- goimports
- goprintffuncname
- gosec
- mirror
- misspell
- nakedret
- nilerr
- noctx
- nolintlint
- revive
- rowserrcheck
- sqlclosecheck
- stylecheck
- tenv
- typecheck
- unconvert
- wastedassign
- whitespace
linters-settings:
exhaustive:
default-signifies-exhaustive: true
# We do not want to enforce every usage of fmt.Errorf to use %w.
errorlint:
errorf: false
# If we want to opt out of a lint, we require an explanation.
nolintlint:
allow-leading-space: true
allow-unused: false
require-explanation: true
require-specific: true
# If gofumpt is run outside a module, it assumes Go 1.0 rather than the
# latest Go. We always want the latest formatting.
#
# https://github.com/mvdan/gofumpt/issues/137
gofumpt:
lang-version: "1.21"
cyclop:
max-complexity: 20
gocyclo:
min-complexity: 30
gocognit:
min-complexity: 30
gci:
no-prefix-comments: true # no leading comment; we allow inline for nolint
sections:
- standard # stdlib
- default # everything not std, not within cloudv2
- prefix(go.panda.dev/cloudv2) # non-apps (proto, pkg)
- prefix(go.panda.dev/cloudv2/apps)
# Gocritic is a meta linter that has very good lints, and most of the
# experimental ones are very good too. There are only a few we want to opt
# out of specifically.
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- evalOrder
- importShadow
# disabled due to 1.18 failures
- hugeParam
- rangeValCopy
- typeDefFirst
- paramTypeCombine
# Revive is yet another metalinter with a lot of useful lints.
# The below opts in to all the ones we would like to use.
revive:
ignore-generated-header: true
enable-all-rules: true
severity: warning
confidence: 0.7
error-code: 1
warning-code: 1
rules:
- name: add-constant
disabled: true
- name: argument-limit
disabled: true
- name: banned-characters
disabled: true
- name: cognitive-complexity
disabled: true
- name: confusing-naming
disabled: true
- name: cyclomatic
disabled: true
- name: file-header
disabled: true
- name: flag-parameter
disabled: true
- name: function-result-limit
disabled: true
- name: function-length
disabled: true
- name: import-shadowing
disabled: true
- name: line-length-limit
disabled: true
- name: max-public-structs
disabled: true
- name: modifies-parameter
disabled: true
- name: nested-structs
disabled: true
- name: package-comments # https://github.com/mgechev/revive/issues/740; stylecheck's ST1000 is better
disabled: true
- name: redefines-builtin-id
disabled: true
- name: unhandled-error
disabled: true
- name: var-naming
- name: waitgroup-by-value