forked from open-component-model/ocm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yaml
174 lines (165 loc) · 5.22 KB
/
.golangci.yaml
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
run:
go: "1.19"
timeout: 10m
tests: false
allow-parallel-runners: true
issues-exit-code: 2
skip-dirs:
- "hack"
# External code from containerd/containerd
- "pkg/docker"
linters:
enable-all: true
disable:
# We are working on it
- wrapcheck
# Logical next step
- forcetypeassert # Priority: that can lead to serious crashes.
- revive # Too many issues.
# It's important to at least address:
# - no camel_case
# - no this and self
# - receiver name a should be consistent
- gomoddirectives # Replacement statements are not allowed in a library.
# if it has a replace statement, other can't use the
# library at all (go does not allow that)
- godox # TODO/FIXME/BUG should not be in the code-base without
# a related GitHub issue.
# Added an exclude-rules for that, if a TODO/FIXME/BUG
# line has an URL on the line, it counts as valid mark.
- errcheck # Too many issues.
- stylecheck # Too many issues.
# No snake_case in Go.
# convert_ComponentReferences_from should be convertComponentReferencesFrom
- nosnakecase
- prealloc # Performance.
- exportloopref
- nilerr # There a few places where we don't return with an error
# in an 'if err != nil {}' block. If it's intentional,
# we should add a '//nolint: nilerr // Reason why...'
- nlreturn # Use empty line at least before return/break/continue.
- goerr113 # Do not define dynamic errors with Errorf.
- varnamelen # m, d, p < These are not so meaningful variables.
- testpackage # Blackbox testing is preffered.
- funlen # Break long functions.
- gomnd # Give constant values a name with constants.
- ireturn # Accept interface, return concrate.
- nestif # Some nexted if statements are 8 or 9 deep.
- dupl # Check code duplications.
- cyclop # Complex functions are not good.
- gochecknoinits # Init functions cause an import to have side effects,
# and side effects are hard to test,
# reduce readability and increase the complexity of code.
- gocyclo # We shouldn't have functions with complexity 51
- gocognit # Another complexity check, they check different things.
- containedctx # Struct should not contain context, action does.
- nilnil # A function should return either something valuable
# or an error, but both value and error as nil is
# useless. Like when I call it, why is it nil? Tell me
# in an error why.
- bodyclose
- unparam
- nonamedreturns # Either named return, or use simply `return`.
# Opinionated (we may want to keep it disabled)
- gochecknoglobals
- lll
- paralleltest
- tagliatelle
- wsl
- interfacebloat
# Disabled with reason
- exhaustruct # Doesn't really make sense.
- exhaustive # Doesn't really make sense.
- logrlint # Doesn't really make sense.
- goimports # acts weirdly, dci handles imports anyway
# Disabled because of generics in go 1.18
- contextcheck
- rowserrcheck
- sqlclosecheck
- wastedassign
# Deprecated
- deadcode
- exhaustivestruct
- golint
- ifshort
- interfacer
- maligned
- scopelint
- structcheck
- varcheck
linters-settings:
gci:
sections:
- standard
- blank
- dot
- default
- prefix(github.com/open-component-model/ocm)
custom-order: true
staticcheck:
go: "1.18"
stylecheck:
go: "1.18"
funlen:
lines: 110
statements: 60
cyclop:
max-complexity: 15
skip-tests: true
nolintlint:
allow-leading-space: false
allow-unused: false
require-explanation: true
require-specific: false
varnamelen:
ignore-names:
- err
- wg
- id
govet:
check-shadowing: true
lll:
line-length: 120
gosec:
exclude-generated: true
issues:
exclude:
- composites
exclude-rules:
- path: cmds/
linters:
- forbidigo
- text: "should not use dot imports|don't use an underscore in package name"
linters:
- golint
- source: "https://"
linters:
- lll
- text: "shadow: declaration of \"err\""
linters:
- govet
- text: "shadow: declaration of \"ok\""
linters:
- govet
- path: _test\.go
linters:
- goerr113
- gocyclo
- errcheck
- gosec
- dupl
- funlen
- scopelint
- text: "Spec.DeepCopyInto undefined"
linters:
- typecheck
- text: "G601: Implicit memory aliasing in for loop"
# Ignored cos why not, that was the request.
linters:
- gosec
- source: "// .* #\\d+"
linters:
- godox
- path: ignore/.*\.go
linters:
- dupword