forked from 23technologies/gardener-extension-shoot-flux
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.golangci.yaml
108 lines (104 loc) · 4.21 KB
/
.golangci.yaml
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
run:
concurrency: 4
deadline: 10m
linters:
enable:
- revive
- unused
- importas
- exportloopref
- nilerr
- whitespace
issues:
exclude-use-default: false
exclude:
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked
# revive:
- var-naming # ((var|const|struct field|func) .* should be .*
- dot-imports # should not use dot imports
- package-comments # package comment should be of the form
- unexported-return # exported func .* returns unexported type .*, which can be annoying to use
- indent-error-flow # if block ends with a return statement, so drop this else and outdent its block
- "exported: (type|func) name will be used as .* by other packages, and that stutters;"
# typecheck:
- "undeclared name: `.*`"
- "\".*\" imported but not used"
# allow non-capitalized messages if they start with technical terms
- "structured logging message should be capitalized: \"garden(er-apiserver|er-controller-manager|er-admission-controller|er-operator|er-resource-manager|let)"
- "exported function SetDefaults_.* should have comment or be unexported"
exclude-rules:
- linters:
- staticcheck
text: "SA1019:" # Excludes messages where deprecated variables are used
exclude-files:
- "zz_generated\\..*\\.go$"
linters-settings:
revive:
rules:
- name: duplicated-imports
- name: unused-parameter
- name: unreachable-code
- name: context-as-argument
- name: early-return
- name: exported
importas:
alias:
- pkg: github.com/stackitcloud/gardener-extension-shoot-flux/pkg/apis/(\w+)/(v[\w\d]+)
alias: $1$2
# External imported packages
- pkg: k8s.io/api/(\w+)/(v[\w\d]+)
alias: $1$2
- pkg: k8s.io/apimachinery/pkg/apis/(\w+)/(v[\w\d]+)
alias: $1$2
- pkg: k8s.io/apimachinery/pkg/api/([^m]\w+)
alias: api${1}
- pkg: k8s.io/apimachinery/pkg/util/(\w+)
alias: util${1}
- pkg: k8s.io/utils/clock/testing
alias: testclock
- pkg: sigs.k8s.io/controller-runtime/pkg/client/fake
alias: fakeclient
- pkg: sigs.k8s.io/controller-runtime/pkg/log/zap
alias: logzap
- pkg: sigs.k8s.io/controller-runtime/pkg/log
alias: logf
# Gardener extension package
- pkg: github.com/gardener/gardener/extensions/.*/(\w+)/mock$
alias: extensionsmock${1}
- pkg: github.com/gardener/gardener/extensions/pkg/apis/config
alias: extensionsconfig
- pkg: github.com/gardener/gardener/extensions/pkg/controller
alias: extensionscontroller
- pkg: github.com/gardener/gardener/extensions/pkg/predicate
alias: extensionspredicate
- pkg: github.com/gardener/gardener/extensions/pkg/controller/([^m]\w+)
alias: extensions${1}controller
- pkg: github.com/gardener/gardener/extensions/pkg/controller/heartbeat/cmd
alias: extensionsheartbeatcmd
- pkg: github.com/gardener/gardener/extensions/pkg/controller/worker/helper
alias: extensionsworkerhelper
- pkg: github.com/gardener/gardener/extensions/pkg/util/secret/manager
alias: extensionssecretsmanager
- pkg: github.com/gardener/gardener/extensions/pkg/webhook
alias: extensionswebhook
- pkg: github.com/gardener/gardener/extensions/pkg/webhook/([^m]\w+)
alias: extensions${1}webhook
# Gardener other packages
- pkg: github.com/gardener/gardener/pkg/api/extensions
alias: apiextensions
- pkg: github.com/gardener/gardener/pkg/apis/core
alias: gardencore
- pkg: github.com/gardener/gardener/pkg/apis/core/([\w\d]+)
alias: gardencore${1}
- pkg: github.com/gardener/gardener/pkg/apis/core/([\w\d]+)/helper
alias: ${1}helper
- pkg: github.com/gardener/gardener/pkg/apis/([^c]\w+)/([\w\d]+)
alias: $1$2
- pkg: github.com/gardener/gardener/pkg/apis/([^c]\w+)/([\w\d]+)/([\w\d]+)
alias: $1$2$3
- pkg: github.com/gardener/gardener/pkg/chartrenderer
alias: chartrenderer
# Flux APIs
- pkg: github.com/fluxcd/(\w+)-controller/api/([\w\d]+)
alias: $1$2