forked from submariner-io/submariner-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
173 lines (167 loc) · 5.1 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
---
linters-settings:
gocritic:
enabled-tags:
- diagnostic
- opinionated
- performance
- style
disabled-checks:
- ifElseChain
- unnamedResult
gocyclo:
min-complexity: 15
godot:
exclude:
- ^\s*\+
govet:
enable:
- fieldalignment
lll:
line-length: 140
wrapcheck:
ignoreSigs:
- .Error(
- .Errorf(
- errors.New(
- errors.Unwrap(
- .Wrap(
- .Wrapf(
- .WithMessage(
- .WithMessagef(
- .WithStack(
wsl:
# Separating explicit var declarations by blank lines seems excessive.
allow-cuddle-declarations: true
linters:
disable-all: true
enable:
- asciicheck
- bidichk
- bodyclose
- contextcheck
# - cyclop # This is equivalent to gocyclo
- deadcode
- depguard
- dogsled
- dupl
- durationcheck
- errcheck
- errorlint
- errname
- exhaustive
# - exhaustivestruct # Not recommended for general use - meant to be used only for special cases
- exportloopref
# - forbidigo # We don't forbid any statements
# - forcetypeassert # There are many unchecked type assertions that would be the result of a programming error so the
# reasonable recourse would be to panic anyway if checked so this doesn't seem useful
# - funlen # gocyclo is enabled which is generally a better metric than simply LOC.
- gci
# - gochecknoglobals # We don't want to forbid global variable constants
# - gochecknoinits # We use init functions for valid reasons
- gocognit
- goconst
- gocritic
- gocyclo
- goerr113
- godot
# - godox # Let's not forbid inline TODOs, FIXMEs et al
- gofmt
- gofumpt
# - goheader # We do license header linting another way
- goimports
# - golint # Deprecated since v1.41.0
# - gomnd # It doesn't seem useful in general to enforce constants for all numeric values
# - gomoddirectives # We don't want to forbid the 'replace' directive
# - gomodguard # We don't block any modules
# - goprintffuncname # This doesn't seem useful at all
- gosec
- gosimple
- govet
# - ifshort # This is a style preference and doesn't seem compelling
- importas
- ineffassign
# - ireturn # The argument to always "Return Concrete Types" doesn't seem compelling. It is perfectly valid to return
# an interface to avoid exposing the entire underlying struct
# - interfacer # Deprecated since v1.38.0
- lll
- makezero
# - maligned # Deprecated since v1.38.0
- misspell
- nakedret
# - nestif # This calculates cognitive complexity but we're doing that elsewhere
- nilerr
- nilnil
# - nlreturn # This is reasonable with a block-size of 2 but setting it above isn't honored
# - noctx # We don't send HTTP requests
- nolintlint
# - paralleltest # Not relevant for Ginkgo UTs
- prealloc
- predeclared
- promlinter
- revive
# - rowserrcheck # We don't use SQL
# - scopelint # Deprecated since v1.39.0
# - sqlclosecheck # We don't use SQL
- staticcheck
- structcheck
- stylecheck
# - tagliatelle # Inconsistent with stylecheck and not as good
# - tenv # Not relevant for our Ginkgo UTs
- testpackage
# - thelper # Not relevant for our Ginkgo UTs
# - tparallel # Not relevant for our Ginkgo UTs
- typecheck
- unconvert
- unparam
- unused
- varcheck
# - varnamelen # It doesn't seem necessary to enforce a minimum variable name length
- wastedassign
- whitespace
- wrapcheck
- wsl
issues:
exclude-rules:
# Allow dot-imports for Gomega BDD directives per idiomatic Gomega
- linters:
- revive
- stylecheck
text: "dot imports"
source: "gomega"
# Allow dot-imports for Ginkgo BDD directives per idiomatic Ginkgo
- linters:
- revive
- stylecheck
text: "dot imports"
source: "ginkgo"
# Ignore long line and variable name non-compliance warnings in auto-generated file
- linters:
- lll
- stylecheck
- revive
path: "pkg/embeddedyamls/yamls.go"
# BrokerK8sApiServer parameter is used by other projects, like ACM,
# so not changing it to BrokerK8sAPIServer as suggested by stylecheck
- linters:
- revive
- stylecheck
text: "struct field BrokerK8sApiServer"
# Ignore pointer bytes in struct alignment tests (this is a very
# minor optimisation)
- linters:
- govet
text: "pointer bytes could be"
# Full text of the error is "do not define dynamic errors, use wrapped static errors instead". See
# https://github.com/Djarvur/go-err113/issues/10 for an interesting discussion of this error. While there are cases
# where wrapped sentinel errors are useful, it seems a bit pedantic to force that pattern in all cases.
- linters:
- goerr113
text: "do not define dynamic errors"
# Ignore certain linters for test files
- path: _test\.go|test/|fake/
linters:
- errname
- gochecknoinits
- goerr113
- wrapcheck