-
Notifications
You must be signed in to change notification settings - Fork 7
/
.golangci.yml
105 lines (101 loc) · 3.05 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
run:
timeout: 5m
go: "1.22"
tests: false
allow-parallel-runners: true
# output:
# format: github-actions
linters:
disable-all: true
enable:
# - dupl # check duplicated code
- goconst # check strings that can turn into constants
- gofmt # check fmt
- goimports # check imports
- gosec # check for security problems
- govet # check vet
- importas # check consistent import aliasing
- ineffassign # check ineffectual assignments
- misspell # check for misspelled English words
- nakedret # check naked returns in functions
- prealloc # check preallocated slice declarations
- revive # replacement for golint
- unconvert # check redundant type conversions
- whitespace # check for trailing whitespace and tabs
linters-settings:
revive:
rules:
# The following rules are recommended https://github.com/mgechev/revive#recommended-configuration
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
- name: increment-decrement
- name: var-naming
- name: var-declaration
- name: package-comments
- name: range
- name: receiver-naming
- name: time-naming
- name: indent-error-flow
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unused-parameter
- name: unreachable-code
- name: redefines-builtin-id
- name: unexported-return
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/util/runtime
alias: utilruntime
- pkg: sigs.k8s.io/controller-runtime/pkg/client
alias: runtimeclient
gosec:
excludes:
- G115 # https://github.com/moby/moby/issues/48358#issuecomment-2323339603
issues:
exclude-files:
- "zz_generated_*"
exclude-rules:
- path: 'pkg/image/scan/report.go'
text: "don't use ALL_CAPS in Go names"
linters:
- revive
# Permit insecure skip tls verify
- path: 'pkg/*'
text: 'TLS InsecureSkipVerify may be true'
linters:
- gosec
# Permit insecure skip tls verify
- path: 'pkg/*'
text: 'TLS InsecureSkipVerify set true'
linters:
- gosec
# Permit pubkey permission to 0644
- path: 'pkg/commands/generate_sigstore_key.go'
text: 'Expect WriteFile permissions to be 0600 or less'
linters:
- gosec
# Permit cobra cmd as unused parameter
- path: 'pkg/commands/*'
text: "unused-parameter: parameter 'cmd' seems to be unused"
linters:
- revive
# Permit cobra args as unused parameter
- path: 'pkg/commands/*'
text: "unused-parameter: parameter 'args' seems to be unused"
linters:
- revive