Skip to content

Commit a8ae016

Browse files
authored
Merge pull request kubernetes-sigs#11142 from schrej/golangci-comments
🌱 golangci: add comments to enabled linters
2 parents 831e017 + e0cca37 commit a8ae016

File tree

1 file changed

+50
-52
lines changed

1 file changed

+50
-52
lines changed

.golangci.yml

Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,62 +4,55 @@ run:
44
build-tags:
55
- tools
66
- e2e
7-
skip-files:
8-
- "zz_generated.*\\.go$"
9-
- "vendored_openapi\\.go$"
10-
# We don't want to invest time to fix new linter findings in old API types.
11-
- "internal/apis/.*"
127
allow-parallel-runners: true
138

149
linters:
1510
disable-all: true
1611
enable:
17-
- asasalint
18-
- asciicheck
19-
- bidichk
20-
- bodyclose
21-
- containedctx
22-
- copyloopvar
23-
- dogsled
24-
- dupword
25-
- durationcheck
26-
- errcheck
27-
- errchkjson
28-
- gci
29-
- ginkgolinter
30-
- goconst
31-
- gocritic
32-
- godot
33-
- gofmt
34-
- goimports
35-
- goprintffuncname
36-
- gosec
37-
- gosimple
38-
- govet
39-
- importas
40-
- ineffassign
41-
- intrange
42-
- loggercheck
43-
- misspell
44-
- nakedret
45-
- nilerr
46-
- noctx
47-
- nolintlint
48-
- nosprintfhostport
49-
- prealloc
50-
- predeclared
51-
- revive
52-
- rowserrcheck
53-
- staticcheck
54-
- stylecheck
55-
- tenv
56-
- thelper
57-
- typecheck
58-
- unconvert
59-
- unparam
60-
- unused
61-
- usestdlibvars
62-
- whitespace
12+
- asasalint # warns about passing []any to func(...any) without expanding it
13+
- asciicheck # non ascii symbols
14+
- bidichk # dangerous unicode sequences
15+
- bodyclose # unclosed http bodies
16+
- containedctx # context.Context nested in a struct
17+
- copyloopvar # copying loop variables
18+
- dogsled # too many blank identifiers in assignments
19+
- dupword # duplicate words
20+
- durationcheck # multiplying two durations
21+
- errcheck # unchecked errors
22+
- errchkjson # invalid types passed to json encoder
23+
- gci # ensures imports are organized
24+
- ginkgolinter # ginkgo and gomega
25+
- goconst # strings that can be replaced by constants
26+
- gocritic # bugs, performance, style (we could add custom ones to this one)
27+
- godot # checks that comments end in a period
28+
- gofmt # warns about incorrect use of fmt functions
29+
- goimports # import formatting
30+
- goprintffuncname # printft-like functions should be named with f at the end
31+
- gosec # potential security problems
32+
- gosimple # simplify code
33+
- govet # basically 'go vet'
34+
- importas # consistent import aliases
35+
- ineffassign # ineffectual assignments
36+
- intrange # suggest using integer range in for loops
37+
- loggercheck # check for even key/value pairs in logger calls
38+
- misspell # spelling
39+
- nakedret # naked returns (named return parameters and an empty return)
40+
- nilerr # returning nil after checking err is not nil
41+
- noctx # http requests without context.Context
42+
- nolintlint # badly formatted nolint directives
43+
- nosprintfhostport # using sprintf to construct host:port in a URL
44+
- prealloc # suggest preallocating slices
45+
- predeclared # shadowing predeclared identifiers
46+
- revive # better version of golint
47+
- staticcheck # some of staticcheck's rules
48+
- stylecheck # another replacement for golint
49+
- tenv # using os.Setenv instead of t.Setenv in tests
50+
- thelper # test helpers not starting with t.Helper()
51+
- unconvert # unnecessary type conversions
52+
- unparam # unused function parameters
53+
- unused # unused constants, variables,functions, types
54+
- usestdlibvars # using variables/constants from the standard library
55+
- whitespace # unnecessary newlines
6356

6457
linters-settings:
6558
gci:
@@ -187,7 +180,6 @@ linters-settings:
187180
alias: infraexpv1
188181
nolintlint:
189182
allow-unused: false
190-
allow-leading-space: false
191183
require-specific: true
192184
revive:
193185
rules:
@@ -224,6 +216,12 @@ linters-settings:
224216
goconst:
225217
ignore-tests: true
226218
issues:
219+
exclude-files:
220+
- "zz_generated.*\\.go$"
221+
- "vendored_openapi\\.go$"
222+
# We don't want to invest time to fix new linter findings in old API types.
223+
- "internal/apis/.*"
224+
227225
max-same-issues: 0
228226
max-issues-per-linter: 0
229227
# We are disabling default golangci exclusions because we want to help reviewers to focus on reviewing the most relevant

0 commit comments

Comments
 (0)