-
Notifications
You must be signed in to change notification settings - Fork 2
/
.golangci.yml
180 lines (178 loc) · 4.29 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
178
179
180
linters:
disable-all: true
enable:
- asciicheck
- bodyclose
- containedctx
- contextcheck
- cyclop
- decorder
- dogsled
- errcheck
- errorlint
- exportloopref
- funlen
- gci
- ginkgolinter
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- gofmt
- gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- importas
- ineffassign
- misspell
- nakedret
- nilerr
- noctx
- prealloc
- predeclared
- revive
- rowserrcheck
- staticcheck
- stylecheck
- thelper
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- wastedassign
- whitespace
- wrapcheck
linters-settings:
godot:
scope: toplevel
exclude:
- '^ \+.*'
- '^ ANCHOR.*'
importas:
no-unaliased: true
alias:
# Kubernetes
- pkg: k8s.io/api/core/v1
alias: corev1
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
alias: metav1
# Controller Runtime
- pkg: sigs.k8s.io/controller-runtime
alias: ctrl
nolintlint:
allow-unused: false
require-specific: true
staticcheck:
go: "1.22"
stylecheck:
go: "1.22"
gocritic:
enabled-tags:
- diagnostic
- style
- performance
- experimental
- opinionated
disabled-checks:
- regexpSimplify
- whyNoLint
cyclop:
max-complexity: 13
revive:
ignore-generated-header: true
severity: error
enable-all-rules: true
rules:
- name: add-constant
disabled: true
- name: argument-limit
disabled: true
- name: banned-characters
disabled: true
- name: cognitive-complexity
severity: error
disabled: false
arguments: [24]
- name: comment-spacings
severity: warning
disabled: false
arguments:
- +kubebuilder
- name: cyclomatic
severity: error
disabled: false
arguments: [13]
- name: file-header
disabled: true
- name: flag-parameter
severity: warning
disabled: true
- name: function-result-limit
disabled: true
- name: function-length
severity: error
disabled: false
arguments: [40, 0]
- name: if-return
disabled: true
- name: line-length-limit
disabled: true
- name: max-public-structs
disabled: true
- name: struct-tag
arguments:
- "json,inline"
severity: warning
disabled: false
- name: unhandled-error
severity: warning
disabled: false
arguments:
- "fmt.Printf"
- name: use-any
disabled: true
funlen:
lines: 65
issues:
exclude-rules:
# As of now we ignore the statements in main
- path: 'cmd/manager/main.go'
text: "Function 'main' has too many statements"
- path: 'cmd/manager/main.go'
text: "function-length: maximum number of statements per function exceeded; max \\d+ but got \\d+"
# This is very C near and those const values are easier to google.
- path: '(.+)/unix/(coil|frr|nl)\.go'
text: "ST1003: should not use ALL_CAPS in Go names; use CamelCase instead"
- path: '(.+)/unix/(coil|frr|nl)\.go'
text: "var-naming: don't use ALL_CAPS in Go names; use CamelCase"
- path: '(.+)/nl/(route|layer2)\.go'
text: 'import-alias-naming:.+\(schiff_unix\).*$'
# Test file exclusions
- path: '(.+)_test\.go'
text: 'unchecked-type-assertion:'
- path: '(.+)_test\.go'
text: 'import-alias-naming:'
- path: '(.+)_test\.go'
text: 'dot-imports:'
# fix issues i currently can't fix.
- path: '(.+)\.go'
text: "string `vrf` has (\\d+) occurrences, make it a constant"
- path: '(.+)/monitoring/frr\.go'
text: "Function '\\w+' is too long"
- path: '(.+)/monitoring/frr\.go'
text: "Function '\\w+' has too many statements"
- path: '(.+)/nl/route\.go'
text: "Function '\\w+' has too many statements"
- path: '(.+)/nl/route\.go'
text: "cyclomatic complexity \\d+ of func `\\w+` is high"
- path: '(.+)/nl/route\.go'
text: "cyclomatic: function \\w+ has cyclomatic complexity \\d+"
- path: '(.+)/nl/route\.go'
text: "calculated cyclomatic complexity for function \\w+ is \\d+, max is \\d+"
run:
timeout: 10m
allow-parallel-runners: true