-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path.golangci.yml
71 lines (63 loc) · 2 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
linters:
# Disable all linters, we explicitly opt into ones we want.
disable-all: true
enable:
- errcheck
- gofumpt
- goimports
- gosec
- gosimple
- govet
- importas
- ineffassign
- misspell
- gocritic
- staticcheck
- stylecheck
- unparam
- unused
linters-settings:
goimports:
local-prefixes: github.com/redpanda-data/redpanda-operator,github.com/redpanda-data/helm-charts
gosec:
excludes:
- G115 # integer overflows aren't super likely to be a problem for us and we're really just at the mercy of the APIs we use.
config:
G306: "0644" # Maximum allowed os.WriteFile Permissions
importas:
alias:
- pkg: k8s.io/api/(\w+)/(v\d)
alias: $1$2
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
alias: metav1
gocritic:
disable-all: true
enabled-checks:
- ruleguard
settings:
# NB: For ruleguard to work, every go.mod must include the ruleguard
# library. This is handled with a stub rules.go file in every module in
# this repository.
ruleguard:
# ${configDir} is the only expanded variable. Paths are otherwise
# relative to the directory that golangci-lint is invoked in.
# rules.go
# - "rules.go" -> Load rules.go for each linted go.mod file due to taskfile cd'ing into each module.
# - "${configDir}/pkg/lint/rules/*.go" -> Load all go files in pkg/lint/rules.
rules: "rules.go,${configDir}/pkg/lint/rules/*.go"
failOn: all # all ensures we get nice error messages if something is misconfigured.
stylecheck:
checks: ["*", "-ST1005"]
issues:
exclude-rules:
# unparam will complain about functions that are called with a constant
# parameter. In production code, that may be helpful but it harms the
# readability of test code to eliminate such cases.
- linters:
- unparam
text: "always receives"
path: '(.+)_test\.go'
# We're not aiming to be secure in our tests.
- linters:
- gosec
path: '(.+)_test\.go'