-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy path.golangci.yml
More file actions
143 lines (138 loc) · 3.77 KB
/
.golangci.yml
File metadata and controls
143 lines (138 loc) · 3.77 KB
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
# Tested with golangci-lint ver. 2.x
version: "2"
run:
timeout: 10m
linters:
default: none
enable:
- asciicheck # checks for non-ASCII identifiers
- bidichk # checks for dangerous unicode sequences (security)
- bodyclose
- copyloopvar
- depguard
- dogsled
# TODO fix issues- dupl
# TODO fix issues- errcheck
- errname # checks error naming conventions
- exhaustive
# TODO fix issues- funlen
- gocheckcompilerdirectives # validates go compiler directives
#- gochecknoinits
- goconst
# TODO fix issues- gocritic
# TODO fix issues- gocyclo
# gofmt and goimports are now formatters in v2, not linters
# TODO fix issues- mnd (formerly gomnd)
- goprintffuncname
# TODO fix issues- gosec
# gosimple and stylecheck are now part of staticcheck in v2
- staticcheck
#- govet
- ineffassign
# TODO fix issues- intrange (2 issues - use integer ranges Go 1.22+)
# TODO fix issues- lll
- makezero # finds slice declarations with non-zero initial length
- misspell
# TODO fix issues- nakedret
# TODO fix issues- nilerr (3 issues - returns nil when error is not nil)
# TODO fix issues- noctx (4 issues - missing context.Context)
# TODO fix issues- prealloc
- reassign # checks package variable reassignment
#- scopelint
- unconvert
# TODO fix issues- unparam
- unused
- whitespace
settings:
depguard:
rules:
main:
deny:
- pkg: github.com/sirupsen/logrus
desc: "logging is allowed only by logutils.Log"
dupl:
threshold: 100
funlen:
lines: 100
statements: 50
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- ifElseChain # style preference - suggests switch over if-else
- whyNoLint # requires explanation for nolint directives
- unnamedResult # style preference - named return values
settings:
hugeParam:
sizeThreshold: 512
rangeValCopy:
sizeThreshold: 512
gocyclo:
min-complexity: 15
mnd:
# don't include the "operation" and "assign"
checks:
- argument
- case
- condition
- return
lll:
line-length: 140
misspell:
locale: US
prealloc:
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
# True by default.
simple: true
range-loops: true # Report preallocation suggestions on range loops, true by default
for-loops: false # Report preallocation suggestions on for loops, false by default
staticcheck:
checks:
- all
- -QF1001 # De Morgan's law suggestions
- -QF1003 # tagged switch suggestions
- -QF1008 # embedded field selector suggestions
dot-import-whitelist:
- github.com/onsi/ginkgo/v2
- github.com/onsi/gomega
- github.com/onsi/gomega/gstruct
exclusions:
generated: lax
presets:
- comments
- std-error-handling
paths:
- vendor/
- .github/
- deployment/
- doc/
- bindata/
- pkg/client
rules:
# Exclude various linters from test files
- path: _test\.go
linters:
- mnd
- gosec
- dupl
- lll
- goconst
# Exclude linters from test/ directory
- path: ^test/
linters:
- goconst
formatters:
enable:
- gofmt
- goimports
settings:
goimports:
local-prefixes:
- github.com/k8snetworkplumbingwg/sriov-network-operator