Skip to content

Commit 200aa2d

Browse files
authored
ci: migrate golangci-lint configuration (#181)
Migrate golangci-lint configuration to v2. Closes #180 Signed-off-by: Francesco Canovai <[email protected]>
1 parent 2d2b274 commit 200aa2d

File tree

1 file changed

+49
-42
lines changed

1 file changed

+49
-42
lines changed

.golangci.yml

Lines changed: 49 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,51 @@
1-
linters-settings:
2-
lll:
3-
line-length: 120
4-
gci:
5-
sections:
6-
- standard
7-
- default
8-
- prefix(github.com/cloudnative-pg/cloudnative-pg)
9-
- blank
10-
- dot
11-
gosec:
12-
excludes:
13-
- G101 # remove this exclude when https://github.com/securego/gosec/issues/1001 is fixed
14-
1+
version: "2"
152
linters:
16-
enable-all: true
3+
default: all
174
disable:
18-
- execinquery
19-
- gomnd
20-
21-
issues:
22-
exclude-rules:
23-
# Allow dot imports for ginkgo and gomega
24-
- source: ginkgo|gomega
25-
linters:
26-
- revive
27-
text: "should not use dot imports"
28-
# Exclude some linters from running on tests files.
29-
- path: _test\.go
30-
linters:
31-
- goconst
32-
# Exclude lll issues for lines with long annotations
33-
- linters:
34-
- lll
35-
source: "//\\s*\\+"
36-
# We have no control of this in zz_generated files and it looks like that excluding those files is not enough
37-
# so we disable "ST1016: methods on the same type should have the same receiver name" in api directory
38-
- linters:
39-
- stylecheck
40-
text: "ST1016:"
41-
path: api/
42-
exclude-use-default: false
43-
exclude-files:
44-
- "zz_generated.*"
5+
- mnd
6+
settings:
7+
lll:
8+
line-length: 120
9+
exclusions:
10+
generated: lax
11+
rules:
12+
- linters:
13+
- revive
14+
text: should not use dot imports
15+
source: ginkgo|gomega
16+
- linters:
17+
- goconst
18+
path: _test\.go
19+
- linters:
20+
- lll
21+
source: //\s*\+
22+
- linters:
23+
- staticcheck
24+
path: api/
25+
text: 'ST1016:'
26+
paths:
27+
- zz_generated.*
28+
- third_party$
29+
- builtin$
30+
- examples$
31+
formatters:
32+
enable:
33+
- gci
34+
- gofmt
35+
- gofumpt
36+
- goimports
37+
settings:
38+
gci:
39+
sections:
40+
- standard
41+
- default
42+
- prefix(github.com/cloudnative-pg/cloudnative-pg)
43+
- blank
44+
- dot
45+
exclusions:
46+
generated: lax
47+
paths:
48+
- zz_generated.*
49+
- third_party$
50+
- builtin$
51+
- examples$

0 commit comments

Comments
 (0)