forked from gorcon/rcon-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
216 lines (211 loc) · 7.15 KB
/
.golangci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
run:
skip-dirs:
- vendor/
skip-files:
- ".*_test.go$"
output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true
# SEE: https://golangci-lint.run/usage/configuration/
linters-settings:
cyclop:
# the maximal code complexity to report
max-complexity: 12
# the maximal average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0)
package-average: 0.0
# should ignore tests (default false)
skip-tests: true
dupl:
# tokens count to trigger issue, 150 by default
threshold: 200
errcheck:
# report about not checking of errors in type assertions: `a := b.(MyStruct)`;
# default is false: such cases aren't reported by default.
check-type-assertions: false
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: false
funlen:
# default is 60
lines: 70
# default is 40
statements: 40
gocognit:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 20
goconst:
# minimal length of string constant, 3 by default
min-len: 3
# minimal occurrences count to trigger, 3 by default
min-occurrences: 2
gocritic:
enabled-tags:
- performance
- style
- experimental
disabled-checks:
- paramTypeCombine
# - whyNoLint
# - commentedOutCode
gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 15
godox:
keywords:
- "BUG"
- "FIXME"
# - "TODO"
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/golangci/golangci-lint
golint:
# minimal confidence for issues, default is 0.8
min-confidence: 0
gomnd:
# List of function patterns to exclude from analysis.
# Values always ignored: `time.Date`,
# `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`,
# `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`.
# Default: []
ignored-functions:
- os.Chmod
- os.Mkdir
- os.MkdirAll
- os.OpenFile
- os.WriteFile
- io.Reader
- io.Writer
- \*cli.Context
govet:
# Enable all analyzers.
# Default: false
enable-all: true
# Disable analyzers by name.
# Run `go tool vet help` to see all analyzers.
# Default: []
disable:
- fieldalignment # too strict
# Settings per analyzer.
settings:
shadow:
# Whether to be strict about shadowing; can be noisy.
# Default: false
strict: true
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/Sirupsen/logrus
- gopkg.in/sirupsen/logrus.v0
- gopkg.in/sirupsen/logrus.v1
- gopkg.in/Sirupsen/logrus.v0
- gopkg.in/Sirupsen/logrus.v1
lll:
line-length: 120 # 120 is default
tagliatelle:
case:
use-field-name: true
rules:
json: snake
yaml: snake
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
misspell:
locale: US
nakedret:
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
max-func-lines: 30
unparam:
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false
unused:
# treat code as a program (not a library) and report unused exported identifiers; default is false.
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false
whitespace:
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
wrapcheck:
# An array of strings that specify substrings of signatures to ignore.
# If this set, it will override the default set of ignored signatures.
# See https://github.com/tomarrell/wrapcheck#configuration for more information.
ignoreSigs:
- .Errorf(
- errors.New(
- errors.Unwrap(
- .Wrap(
- .Wrapf(
- .WithMessage(
- .WithMessagef(
- .WithStack(
- telnet.DialInteractive(
- Close()
ignorePackageGlobs:
- encoding/*
- github.com/pkg/*
wsl:
# If true append is only allowed to be cuddled if appending value is
# matching variables, fields or types on line above. Default is true.
strict-append: true
# Allow calls and assignments to be cuddled as long as the lines have any
# matching variables, fields or types. Default is true.
allow-assign-and-call: true
# Allow multiline assignments to be cuddled. Default is true.
allow-multiline-assign: true
# Allow declarations (var) to be cuddled.
allow-cuddle-declarations: true
# Allow trailing comments in ending of blocks
allow-trailing-comment: true
# Force newlines in end of case at this limit (0 = never).
force-case-trailing-whitespace: 0
linters:
enable-all: true
disable:
- interfacer # is deprecated (since v1.38.0)
- scopelint # is deprecated (since v1.39.0)
- golint # is deprecated (since v1.41.0)
- maligned # is deprecated (since v1.38.0)
- ifshort # is deprecated (since v1.48.0)
- deadcode # is deprecated (since v1.49.0)
- nosnakecase # is deprecated (since v1.48.1)
- varcheck # is deprecated (since v1.49.0)
- exhaustivestruct # is deprecated (since v1.46.0)
- structcheck # is deprecated (since v1.49.0)
- rowserrcheck # is disabled because of generics
- sqlclosecheck # is disabled because of generics
- structcheck # is disabled because of generics
- wastedassign # is disabled because of generics
- varnamelen # [great idea, but too many false positives] checks that the length of a variable's name matches its scope
- exhaustruct
- depguard
- tagalign
issues:
exclude:
- "Version`? is a global variable" # gochecknoglobals
- "cognitive complexity \\d+ of func `Interactive` is high" # gocognit
- "are|is missing in" # exhaustivestruct # v1.33
exclude-rules:
- source: "^//\\s*go:generate\\s"
linters: [ lll ]
- source: "(noinspection|TODO)"
linters: [ godot ]
- source: "//noinspection"
linters: [ gocritic ]
- path: "_test\\.go"
linters:
- bodyclose
- dupl
- funlen
- goconst
- gosec
- noctx
- wrapcheck