Skip to content

Commit 829ba29

Browse files
linter: Update linter config
Remove deprecated linters and add working setting for previously excluded linters.
1 parent 642c536 commit 829ba29

File tree

1 file changed

+51
-8
lines changed

1 file changed

+51
-8
lines changed

.golangci.yml

+51-8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ linters-settings:
1818
gofmt:
1919
# simplify code: gofmt with `-s` option, true by default
2020
simplify: true
21+
funlen:
22+
# Checks the number of lines in a function.
23+
# If lower than 0, disable the check.
24+
lines: 200
25+
# Checks the number of statements in a function.
26+
statements: 80
27+
gosec:
28+
excludes:
29+
- G402 # Look for bad TLS connection settings.
30+
- G306 # Poor file permissions used when writing to a new file.
2131

2232
linters:
2333
enable-all: true
@@ -32,16 +42,49 @@ linters:
3242
# them even longer by marking them as 'nolint'.
3343
- lll
3444

35-
# We don't care (enough) about misaligned structs to lint that.
36-
- maligned
37-
38-
# We have long functions, especially in tests. Moving or renaming those
39-
# would trigger funlen problems that we may not want to solve at that time.
40-
- funlen
45+
# We don't require that all structs have all fields initialized when new
46+
# instances are created.
47+
- exhaustruct
4148

42-
# Gosec is outdated and reports false positives.
43-
- gosec
49+
# Deprecated linters. See https://golangci-lint.run/usage/linters/.
50+
- interfacer
51+
- golint
52+
- maligned
53+
- scopelint
54+
- exhaustivestruct
55+
- bodyclose
56+
- contextcheck
57+
- nilerr
58+
- noctx
59+
- rowserrcheck
60+
- sqlclosecheck
61+
- structcheck
62+
- tparallel
63+
- unparam
64+
- wastedassign
65+
- ifshort
66+
- varcheck
67+
- deadcode
68+
- nosnakecase
4469

4570
issues:
4671
# Only show newly introduced problems.
4772
new-from-rev: 4008b92d81d4d62e663025c5f79ebe44b53f283c
73+
74+
exclude-rules:
75+
# Exclude gosec from running for tests so that tests with weak randomness
76+
# (math/rand) will pass the linter. We also exclude funlen from tests as
77+
# have test functions that are intentionally long.
78+
- path: _test\.go
79+
linters:
80+
- gosec
81+
- funlen
82+
83+
- path: test*
84+
linters:
85+
- gosec
86+
- funlen
87+
88+
- path: itest/.*
89+
linters:
90+
- paralleltest

0 commit comments

Comments
 (0)