forked from opendatahub-io/llama-stack-k8s-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
152 lines (149 loc) · 4.16 KB
/
.golangci.yml
File metadata and controls
152 lines (149 loc) · 4.16 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
144
145
146
147
148
149
150
151
152
run:
deadline: 10m
linters-settings:
gocyclo:
min-complexity: 30
lll:
line-length: 180
gci:
sections:
- standard
- default
- blank
- dot
skip-generated: false
custom-order: true
goconst:
ignore-strings: "true|false"
errcheck:
check-type-assertions: true
exhaustive:
check:
- switch
default-signifies-exhaustive: true
funlen:
lines: 100
statements: 100
ignore-comments: true
nolintlint:
allow-no-explanation: [ funlen, lll ]
require-specific: true
ireturn:
allow:
# defaults https://golangci-lint.run/usage/linters/#ireturn
- anon
- error
- empty
- stdlib
- sigs.k8s.io/controller-runtime/pkg/client.Client
revive:
rules:
- name: dot-imports
arguments:
- allowedPackages: ["github.com/onsi/ginkgo/v2","github.com/onsi/gomega","github.com/onsi/gomega/gstruct"]
perfsprint:
sprintf1: false
strconcat: false
# Enable gocritic for detecting bugs, performance, and style issues: https://golangci-lint.run/usage/linters/#gocritic
gocritic:
# https://go-critic.com/overview.html#checkers
enabled-checks:
- deferInLoop
- unnecessaryDefer
govet:
disable:
- fieldalignment # Too aggressive about struct field alignment
enable:
- shadow
- assign
- atomic
- bools
- buildtag
- cgocall
- composites
- copylocks
- deepequalerrors
- errorsas
- findcall
- httpresponse
- ifaceassert
- loopclosure
- lostcancel
- nilfunc
- nilness
- printf
- reflectvaluecompare
- shift
- sigchanyzer
- sortslice
- stdmethods
- stringintconv
- structtag
- testinggoroutine
- tests
- unmarshal
- unreachable
- unsafeptr
- unusedresult
errorlint:
# Report when error variables are used in string concatenation
errorf: true
# Report when error is compared to nil and error.Is() should be used instead
asserts: true
# Enable reporting of issues related to error wrapping
errorf-multi: true
usetesting:
# Same as tenv but enhanced - default is false
allow-non-string: true
mnd:
# Don't report magic numbers in certain contexts
ignored-functions:
- time.Duration
- time.Sleep
- time.Second
ignored-numbers:
- '0'
- '1'
- '2'
- '5' # Allow 5 for timeouts
- '10'
- '100'
linters:
enable-all: true
disable:
- depguard # [replaced by gomodguard] checks if package imports are in a list of acceptable packages
- exhaustruct # Prevents empty struct. We use a lot of these so I think it is safe to disable.c
- forbidigo
- gochecknoglobals # Prevents use of global vars.
- gofumpt
- gomoddirectives # Doesnot allow replace in go mod file
- nestif
- nilnil
- paralleltest # [too many false positives] detects missing usage of t.Parallel() method in your Go test
- tagliatelle
- varnamelen # doesnot allow shorter names like c,k etc. But golang prefers short named vars.
- wsl # [too strict and mostly code is not more readable] whitespace linter forces you to use empty lines
- wrapcheck # check if this is required. Prevents direct return of err.
- err113 # Too strict and conflicts with our error handling approach, using errorlint instead
- nonamedreturns # Too restrictive and not compatible with our code style
- nlreturn # [too strict and mostly code is not more readable] checks for a new line before return and branch statements to increase code clarity
- testpackage # Too restrictive for our test organization
# Disable linters that need Go 1.22
- copyloopvar # Requires Go 1.22
- intrange # Requires Go 1.22
# Deprecated linters in v1.64.4
- tenv # Deprecated since v1.64.0, replaced by usetesting
# Remove exportloopref from disabled list as it's already deactivated
issues:
exclude-dirs:
- apis
exclude-rules:
- path: _test\.go
linters:
- errcheck
- dupl
- gosec
- funlen
- path: zz_generated
linters:
- lll