Skip to content

Commit 7920222

Browse files
committed
Migrate Linter config to v2
Signed-off-by: Vincent Shen <[email protected]>
1 parent 9458ef1 commit 7920222

File tree

4 files changed

+78
-116
lines changed

4 files changed

+78
-116
lines changed

.golangci.yml

Lines changed: 76 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,35 @@
1-
---
1+
version: "2"
22
run:
3+
concurrency: 6
34
build-tags:
45
- netgo
56
- e2e
6-
concurrency: 6
7-
deadline: 5m
87
linters:
9-
disable-all: true
8+
default: none
109
enable:
1110
- asciicheck
1211
- bodyclose
13-
- deadcode
14-
- depguard
1512
- dogsled
1613
- dupl
14+
- err113
1715
- errcheck
1816
- errorlint
1917
- exhaustive
20-
- exportloopref
21-
- gci
2218
- gochecknoinits
2319
- gocognit
2420
- goconst
2521
- gocritic
2622
- gocyclo
27-
# TODO(jaosorior): Re-Add later
28-
#- godot
2923
- godox
30-
- goerr113
31-
- gofmt
32-
- gofumpt
3324
- goheader
34-
- goimports
35-
- golint
36-
- gomnd
3725
- gomodguard
3826
- goprintffuncname
3927
- gosec
40-
- gosimple
4128
- govet
4229
- ineffassign
43-
- interfacer
4430
- lll
45-
- maligned
4631
- misspell
32+
- mnd
4733
- nakedret
4834
- nestif
4935
- noctx
@@ -52,101 +38,80 @@ linters:
5238
- rowserrcheck
5339
- sqlclosecheck
5440
- staticcheck
55-
- structcheck
56-
- stylecheck
5741
- tparallel
58-
- typecheck
5942
- unconvert
6043
- unparam
6144
- unused
62-
- varcheck
6345
- whitespace
6446
- wrapcheck
65-
# - exhaustivestruct
66-
# - funlen
67-
# - gochecknoglobals
68-
# - nlreturn
69-
# - scopelint
70-
# - testpackage
71-
# - wsl
72-
linters-settings:
73-
gci:
74-
local-prefixes: containers/selinuxd
75-
errcheck:
76-
check-type-assertions: true
77-
check-blank: true
78-
godox:
79-
keywords:
80-
- BUG
81-
- FIXME
82-
- HACK
83-
gocritic:
84-
enabled-checks:
85-
# Diagnostic
86-
- appendAssign
87-
- argOrder
88-
- badCond
89-
- caseOrder
90-
- codegenComment
91-
- commentedOutCode
92-
- deprecatedComment
93-
- dupArg
94-
- dupBranchBody
95-
- dupCase
96-
- dupSubExpr
97-
- exitAfterDefer
98-
- flagDeref
99-
- flagName
100-
- nilValReturn
101-
- offBy1
102-
- sloppyReassign
103-
- weakCond
104-
- octalLiteral
105-
106-
# Performance
107-
- appendCombine
108-
- equalFold
109-
- hugeParam
110-
- indexAlloc
111-
- rangeExprCopy
112-
- rangeValCopy
113-
114-
# Style
115-
- assignOp
116-
- boolExprSimplify
117-
- captLocal
118-
- commentFormatting
119-
- commentedOutImport
120-
- defaultCaseOrder
121-
- docStub
122-
- elseif
123-
- emptyFallthrough
124-
- emptyStringTest
125-
- hexLiteral
126-
- ifElseChain
127-
- methodExprCall
128-
- regexpMust
129-
- singleCaseSwitch
130-
- sloppyLen
131-
- stringXbytes
132-
- switchTrue
133-
- typeAssertChain
134-
- typeSwitchVar
135-
- underef
136-
- unlabelStmt
137-
- unlambda
138-
- unslice
139-
- valSwap
140-
- wrapperFunc
141-
- yodaStyleExpr
142-
143-
# Opinionated
144-
- builtinShadow
145-
- importShadow
146-
- initClause
147-
- nestingReduce
148-
- paramTypeCombine
149-
- ptrToRefParam
150-
- typeUnparen
151-
- unnamedResult
152-
- unnecessaryBlock
47+
settings:
48+
errcheck:
49+
check-type-assertions: true
50+
check-blank: true
51+
gocritic:
52+
enabled-checks:
53+
- commentedOutCode
54+
- nilValReturn
55+
- sloppyReassign
56+
- weakCond
57+
- octalLiteral
58+
- appendCombine
59+
- equalFold
60+
- hugeParam
61+
- indexAlloc
62+
- rangeExprCopy
63+
- rangeValCopy
64+
- boolExprSimplify
65+
- commentedOutImport
66+
- docStub
67+
- emptyFallthrough
68+
- emptyStringTest
69+
- hexLiteral
70+
- methodExprCall
71+
- stringXbytes
72+
- typeAssertChain
73+
- unlabelStmt
74+
- yodaStyleExpr
75+
- builtinShadow
76+
- importShadow
77+
- initClause
78+
- nestingReduce
79+
- paramTypeCombine
80+
- ptrToRefParam
81+
- typeUnparen
82+
- unnamedResult
83+
- unnecessaryBlock
84+
godox:
85+
keywords:
86+
- BUG
87+
- FIXME
88+
- HACK
89+
exclusions:
90+
generated: lax
91+
presets:
92+
- comments
93+
- common-false-positives
94+
- legacy
95+
- std-error-handling
96+
paths:
97+
- third_party$
98+
- builtin$
99+
- examples$
100+
formatters:
101+
enable:
102+
- gci
103+
- gofmt
104+
- gofumpt
105+
- goimports
106+
settings:
107+
gci:
108+
sections:
109+
- Standard
110+
- Default
111+
- Prefix(containers/selinuxd)
112+
exclusions:
113+
generated: lax
114+
paths:
115+
- third_party$
116+
- builtin$
117+
- examples$

pkg/daemon/daemon_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ func getHTTPClient(sockpath string) *http.Client {
5757
return &http.Client{
5858
Transport: &http.Transport{
5959
DialContext: func(_ context.Context, _, _ string) (net.Conn, error) {
60-
//nolint: wrapcheck // let's not complicate the test
6160
return net.Dial("unix", sockpath)
6261
},
6362
},

pkg/datastore/bbolt.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ func (ds *bboltDataStore) List() ([]string, error) {
124124
if root == nil {
125125
return ErrDataStoreNotInitialized
126126
}
127-
//nolint:wrapcheck // this is a closure
128127
return root.ForEach(func(k, v []byte) error {
129128
output = append(output, string(k))
130129
return nil
@@ -142,7 +141,6 @@ func (ds *bboltDataStore) Remove(policy string) error {
142141
if root == nil {
143142
return ErrDataStoreNotInitialized
144143
}
145-
//nolint:wrapcheck // this is a closure
146144
return root.DeleteBucket([]byte(policy))
147145
})
148146
if err != nil {

tests/e2e/helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
"strings"
99
"time"
1010

11-
//nolint:golint,stylecheck
11+
//nolint:staticcheck
1212
. "github.com/onsi/ginkgo/v2"
13-
//nolint:golint,stylecheck
13+
//nolint:staticcheck
1414
. "github.com/onsi/gomega"
1515
)
1616

0 commit comments

Comments
 (0)