-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.golangci.yml
148 lines (143 loc) · 3.33 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
linters-settings:
depguard:
rules:
errors-handling:
deny:
- pkg: "github.com/pkg/errors"
desc: "use built-in errors/fmt packages"
gocyclo:
min-complexity: 16
cyclop:
max-complexity: 16
dupl:
threshold: 128
funlen:
lines: 128
statements: 64
goconst:
min-len: 4
min-occurrences: 3
misspell:
locale: US
ignore-words:
- istio
- k8s
lll:
line-length: 180
goimports:
local-prefixes: github.com/maistra/odh-platform
gocritic:
enabled-tags:
- performance
- style
- experimental
disabled-checks:
- wrapperFunc
- commentFormatting # https://github.com/go-critic/go-critic/issues/755
- hugeParam # seems to be premature optimization based on https://github.com/Maistra/istio-workspace/pull/378#discussion_r392208906
nestif:
min-complexity: 8
unused:
check-exported: true
gocognit:
min-complexity: 20
wrapcheck:
ignoreSigs:
- fmt.Errorf(
- errors.New(
- errors.Unwrap(
- errors.Join(
revive:
rules:
- name: dot-imports
arguments:
- allowedPackages: [
"github.com/onsi/ginkgo/v2",
"github.com/onsi/gomega",
"github.com/onsi/gomega/gstruct",
"github.com/opendatahub-io/odh-platform/test/matchers"
]
importas:
alias:
- pkg: k8s.io/apimachinery/pkg/api/errors
alias: k8serr
# Ensures that i.e. k8s.io/api/rbac/v1 is aliased as rbacv1
- pkg: k8s.io/api/(\w+)/(v[\w\d]+)
alias: $1$2
- pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
alias: apiextv1
- pkg: github.com/(openshift)/api/(\w+)/(v[\w\d]+)
alias: $1$2$3
- pkg: github.com/kuadrant/(authorino)/api/(v[\w\d]+)
alias: $1$2
- pkg: (istio).io/api/(\w+)/(v[\w\d]+)
alias: $1$2$3
- pkg: (istio).io/client-go/pkg/apis/(\w+)/(v[\w\d]+)
alias: $1$2$3
ireturn:
allow:
# defaults https://golangci-lint.run/usage/linters/#ireturn
- anon
- error
- empty
- stdlib
# also allow generics
- generic
# for custom Gomega matchers
- types.GomegaMatcher
varnamelen:
ignore-names:
- g # g Gomega
- vs # VirtualService
linters:
enable-all: true
disable:
- err113
- exhaustruct
- forbidigo
- gofmt # We use goimports and when using them both leads to contradicting errors
- gofumpt
- mnd
- paralleltest
- prealloc
# Temporarily ignored due to "wip"
- godox
- gomoddirectives # we need replace to be aligned with ODH Operator
# Deprecated
- gomnd
run:
timeout: 10m
output:
formats:
- format: colored-line-number
print-issued-lines: true
print-linter-name: true
issues:
max-issues-per-linter: 0
max-same-issues: 0
exclude-rules:
- path: test/
linters:
- goconst
- gocyclo
- golint
- errcheck
- dupl
- gosec
- revive
- stylecheck
- wrapcheck
# Exclude particular linters for tests files.
- path: _test\.go
linters:
- gochecknoglobals
- gocyclo
- errcheck
- dupl
- gosec
- revive
- wrapcheck
- path: _suite_test\.go
linters:
- revive
- unused