Skip to content

Commit 60ac0dd

Browse files
authoredMar 1, 2025··
feat: new linters configuration (#5475)
1 parent a2b6412 commit 60ac0dd

File tree

170 files changed

+5140
-6062
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+5140
-6062
lines changed
 

‎.golangci.next.reference.yml

+3,626-3,649
Large diffs are not rendered by default.

‎.golangci.yml

+87-86
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
version: "2"
1515

1616
linters:
17-
disable-all: true
17+
default: none
1818
# This list of linters is not a recommendation (same thing for all this configuration file).
1919
# We intentionally use a limited set of linters.
2020
# See the comment on top of this file.
@@ -53,6 +53,92 @@ linters:
5353
- unparam
5454
- unused
5555
- whitespace
56+
57+
settings:
58+
depguard:
59+
rules:
60+
logger:
61+
deny:
62+
# logging is allowed only by logutils.Log,
63+
- pkg: "github.com/sirupsen/logrus"
64+
desc: logging is allowed only by logutils.Log.
65+
- pkg: "github.com/pkg/errors"
66+
desc: Should be replaced by standard lib errors package.
67+
- pkg: "github.com/instana/testify"
68+
desc: It's a fork of github.com/stretchr/testify.
69+
files:
70+
# logrus is allowed to use only in logutils package.
71+
- "!**/pkg/logutils/**.go"
72+
dupl:
73+
threshold: 100
74+
funlen:
75+
lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner.
76+
statements: 50
77+
goconst:
78+
min-len: 2
79+
min-occurrences: 3
80+
gocritic:
81+
enabled-tags:
82+
- diagnostic
83+
- experimental
84+
- opinionated
85+
- performance
86+
- style
87+
disabled-checks:
88+
- dupImport # https://github.com/go-critic/go-critic/issues/845
89+
- ifElseChain
90+
- octalLiteral
91+
- whyNoLint
92+
gocyclo:
93+
min-complexity: 15
94+
godox:
95+
keywords:
96+
- FIXME
97+
mnd:
98+
# don't include the "operation" and "assign"
99+
checks:
100+
- argument
101+
- case
102+
- condition
103+
- return
104+
ignored-numbers:
105+
- '0'
106+
- '1'
107+
- '2'
108+
- '3'
109+
ignored-functions:
110+
- strings.SplitN
111+
govet:
112+
settings:
113+
printf:
114+
funcs:
115+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
116+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
117+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
118+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
119+
enable:
120+
- nilness
121+
- shadow
122+
errorlint:
123+
asserts: false
124+
lll:
125+
line-length: 140
126+
misspell:
127+
locale: US
128+
ignore-rules:
129+
- "importas" # linter name
130+
nolintlint:
131+
allow-unused: false # report any unused nolint directives
132+
require-explanation: true # require an explanation for nolint directives
133+
require-specific: true # require nolint directives to be specific about which linter is being skipped
134+
revive:
135+
rules:
136+
- name: indent-error-flow
137+
- name: unexported-return
138+
disabled: true
139+
- name: unused-parameter
140+
- name: unused-receiver
141+
56142
exclusions:
57143
presets:
58144
- comments
@@ -95,88 +181,3 @@ formatters:
95181
local-prefixes:
96182
- github.com/golangci/golangci-lint
97183

98-
linters-settings:
99-
depguard:
100-
rules:
101-
logger:
102-
deny:
103-
# logging is allowed only by logutils.Log,
104-
- pkg: "github.com/sirupsen/logrus"
105-
desc: logging is allowed only by logutils.Log.
106-
- pkg: "github.com/pkg/errors"
107-
desc: Should be replaced by standard lib errors package.
108-
- pkg: "github.com/instana/testify"
109-
desc: It's a fork of github.com/stretchr/testify.
110-
files:
111-
# logrus is allowed to use only in logutils package.
112-
- "!**/pkg/logutils/**.go"
113-
dupl:
114-
threshold: 100
115-
funlen:
116-
lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner.
117-
statements: 50
118-
goconst:
119-
min-len: 2
120-
min-occurrences: 3
121-
gocritic:
122-
enabled-tags:
123-
- diagnostic
124-
- experimental
125-
- opinionated
126-
- performance
127-
- style
128-
disabled-checks:
129-
- dupImport # https://github.com/go-critic/go-critic/issues/845
130-
- ifElseChain
131-
- octalLiteral
132-
- whyNoLint
133-
gocyclo:
134-
min-complexity: 15
135-
godox:
136-
keywords:
137-
- FIXME
138-
mnd:
139-
# don't include the "operation" and "assign"
140-
checks:
141-
- argument
142-
- case
143-
- condition
144-
- return
145-
ignored-numbers:
146-
- '0'
147-
- '1'
148-
- '2'
149-
- '3'
150-
ignored-functions:
151-
- strings.SplitN
152-
govet:
153-
settings:
154-
printf:
155-
funcs:
156-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
157-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
158-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
159-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
160-
enable:
161-
- nilness
162-
- shadow
163-
errorlint:
164-
asserts: false
165-
lll:
166-
line-length: 140
167-
misspell:
168-
locale: US
169-
ignore-rules:
170-
- "importas" # linter name
171-
nolintlint:
172-
allow-unused: false # report any unused nolint directives
173-
require-explanation: true # require an explanation for nolint directives
174-
require-specific: true # require nolint directives to be specific about which linter is being skipped
175-
revive:
176-
rules:
177-
- name: indent-error-flow
178-
- name: unexported-return
179-
disabled: true
180-
- name: unused-parameter
181-
- name: unused-receiver
182-

0 commit comments

Comments
 (0)
Please sign in to comment.