-
Notifications
You must be signed in to change notification settings - Fork 243
Expand file tree
/
Copy path.golangci.yaml
More file actions
130 lines (127 loc) · 3.59 KB
/
.golangci.yaml
File metadata and controls
130 lines (127 loc) · 3.59 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
# https://golangci-lint.run/usage/linters
linters:
disable-all: true
enable:
- asciicheck
- bodyclose
- copyloopvar
- depguard
- dogsled
- errcheck
- errorlint
- gci
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- goprintffuncname
- gosimple
- govet
- importas
- ineffassign
- misspell
- nakedret
- nilerr
- nolintlint
- prealloc
- revive
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- whitespace
linters-settings:
gci:
sections:
- standard
- default
- prefix(sigs.k8s.io/kwok)
- blank
- dot
skip-generated: true
custom-order: true
importas:
no-unaliased: true
alias:
# Kubernetes
- pkg: k8s.io/api/core/v1
alias: corev1
- pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
alias: apiextensionsv1
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
alias: metav1
- pkg: k8s.io/apimachinery/pkg/api/errors
alias: apierrors
stylecheck:
checks:
- "all"
- "-ST1000"
- "-ST1003"
depguard:
rules:
main:
deny:
# https://go.dev/doc/go1.16#ioutil
- pkg: "io/ioutil"
desc: "please see https://go.dev/doc/go1.16#ioutil"
# Use sigs.k8s.io/kwok/pkg/log, which is a wrapper around slog
- pkg: "k8s.io/klog/v2"
desc: "please use `sigs.k8s.io/kwok/pkg/log` instead"
- pkg: "k8s.io/klog"
desc: "please use `sigs.k8s.io/kwok/pkg/log` instead"
- pkg: "golang.org/x/exp/slog"
desc: "please use `sigs.k8s.io/kwok/pkg/log` instead"
- pkg: "log/slog"
desc: "please use `sigs.k8s.io/kwok/pkg/log` instead"
- pkg: "log"
desc: "please use `sigs.k8s.io/kwok/pkg/log` instead"
# Use sigs.k8s.io/kwok/pkg/utils/yaml, which is a wrapper around yaml
- pkg: "k8s.io/apimachinery/pkg/util/yaml"
desc: "please use `sigs.k8s.io/kwok/pkg/utils/yaml` instead"
- pkg: "sigs.k8s.io/yaml"
desc: "please use `sigs.k8s.io/kwok/pkg/utils/yaml` instead"
# Use sigs.k8s.io/kwok/pkg/utils/wait, which is a wrapper around wait
- pkg: "k8s.io/apimachinery/pkg/util/wait"
desc: "please use `sigs.k8s.io/kwok/pkg/utils/wait` instead"
# Use sigs.k8s.io/kwok/pkg/utils/slices, which is a wrapper around slices
- pkg: "k8s.io/utils/strings/slices"
desc: "please use `sigs.k8s.io/kwok/pkg/utils/slices` instead"
gocyclo:
min-complexity: 50
goconst:
min-len: 5
min-occurrences: 10
ignore-tests: true
match-constant: false
revive:
rules:
- name: exported
arguments:
- disableStutteringCheck
issues:
max-same-issues: 0
max-issues-per-linter: 0
# We are disabling default golangci exclusions because we want to help reviewers to focus on reviewing the most relevant
# changes in PRs and avoid nitpicking.
exclude-use-default: false
exclude-files:
- ".*\\.zz_generated\\..*"
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
# The Kubernetes naming convention for conversion functions uses underscores
# and intentionally deviates from normal Go conventions to make those function
# names more readable. Same for SetDefaults_*.
- linters:
- stylecheck
- revive
text: "(ST1003: should not use underscores in Go names; func (Convert_.*_To_.*|SetDefaults_)|exported: exported function (Convert|SetDefaults)_.* should be of the form)"
run:
concurrency: 1
timeout: 10m
allow-parallel-runners: false
allow-serial-runners: true
go: "1.24.0"