Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

Commit df698e5

Browse files
Removing lint excludes which causes false positives
Signed-off-by: Chris Hein <[email protected]>
1 parent f535029 commit df698e5

File tree

1 file changed

+112
-23
lines changed

1 file changed

+112
-23
lines changed

.golangci.yml

Lines changed: 112 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,122 @@
11
linters:
2-
enable-all: true
3-
disable:
4-
- dupl
5-
- funlen
6-
- gochecknoglobals
7-
- gochecknoinits
8-
- lll
9-
- godox
10-
- wsl
11-
- whitespace
12-
- gocognit
13-
- gomnd
14-
- interfacer
15-
- godot
16-
- goerr113
17-
- nestif
18-
# Run with --fast=false for more extensive checks
19-
fast: true
2+
disable-all: true
3+
enable:
4+
- asciicheck
5+
- bodyclose
6+
- deadcode
7+
- depguard
8+
- dogsled
9+
- exportloopref
10+
- errcheck
11+
- goconst
12+
- gocritic
13+
- gocyclo
14+
- godot
15+
- gofmt
16+
- goimports
17+
- goprintffuncname
18+
- gosec
19+
- gosimple
20+
- govet
21+
- importas
22+
- ineffassign
23+
- misspell
24+
- nakedret
25+
- nolintlint
26+
- prealloc
27+
- revive
28+
- rowserrcheck
29+
- staticcheck
30+
- structcheck
31+
- stylecheck
32+
- typecheck
33+
- unconvert
34+
- unparam
35+
- varcheck
36+
- whitespace
37+
38+
linters-settings:
39+
staticcheck:
40+
go: "1.16"
41+
stylecheck:
42+
go: "1.16"
43+
importas:
44+
no-unaliased: true
45+
alias:
46+
# Kubernetes
47+
- pkg: k8s.io/api/core/v1
48+
alias: corev1
49+
- pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
50+
alias: apiextensionsv1
51+
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
52+
alias: metav1
53+
- pkg: k8s.io/apimachinery/pkg/api/errors
54+
alias: apierrors
55+
- pkg: k8s.io/apimachinery/pkg/util/errors
56+
alias: kerrors
57+
# Controller Runtime
58+
- pkg: sigs.k8s.io/controller-runtime
59+
alias: ctrl
60+
2061
issues:
2162
max-same-issues: 0
2263
max-issues-per-linter: 0
64+
# We are disabling default golangci exclusions because we want to help reviewers to focus on reviewing the most relevant
65+
# changes in PRs and avoid nitpicking.
66+
exclude-use-default: false
2367
# List of regexps of issue texts to exclude, empty list by default.
2468
exclude:
25-
- Using the variable on range scope `(tc)|(rt)|(tt)|(test)|(testcase)|(testCase)` in function literal
26-
- "G108: Profiling endpoint is automatically exposed on /debug/pprof"
69+
- "G108: Profiling endpoint is automatically exposed on /debug/pprof"
70+
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
71+
- "exported: exported method .*\\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported"
72+
# The following are being worked on to remove their exclusion. This list should be reduced or go away all together over time.
73+
# If it is decided they will not be addressed they should be moved above this comment.
74+
- Subprocess launch(ed with variable|ing should be audited)
75+
- (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)
76+
- (G104|G307)
77+
exclude-rules:
78+
# With Go 1.16, the new embed directive can be used with an un-named import,
79+
# revive (previously, golint) only allows these to be imported in a main.go, which wouldn't work for us.
80+
# This directive allows the embed package to be imported with an underscore everywhere.
81+
- linters:
82+
- revive
83+
source: _ "embed"
84+
# Exclude some packages or code to require comments, for example test code, or fake clients.
85+
- linters:
86+
- revive
87+
text: exported (method|function|type|const) (.+) should have comment or be unexported
88+
source: (func|type).*Fake.*
89+
- linters:
90+
- revive
91+
text: exported (method|function|type|const) (.+) should have comment or be unexported
92+
path: fake_\.go
93+
- linters:
94+
- revive
95+
text: exported (method|function|type|const) (.+) should have comment or be unexported
96+
path: .*test/(providers|framework|e2e).*.go
97+
# Disable unparam "always receives" which might not be really
98+
# useful when building libraries.
99+
- linters:
100+
- unparam
101+
text: always receives
102+
# Dot imports for gomega or ginkgo are allowed
103+
# within test files.
104+
- path: _test\.go
105+
text: should not use dot imports
106+
- path: _test\.go
107+
text: cyclomatic complexity
108+
- path: test/(framework|e2e).*.go
109+
text: should not use dot imports
110+
# Append should be able to assign to a different var/slice.
111+
- linters:
112+
- gocritic
113+
text: "appendAssign: append result not assigned to the same slice"
114+
27115
run:
28116
timeout: 10m
29117
skip-files:
30-
- "zz_generated.*\\.go$"
31-
- ".*conversion.*\\.go$"
118+
- "zz_generated.*\\.go$"
119+
- ".*conversion.*\\.go$"
32120
skip-dirs:
33-
- third_party
121+
- third_party
122+
allow-parallel-runners: true

0 commit comments

Comments
 (0)