-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path.golangci.yml
150 lines (147 loc) · 5.31 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
output:
formats:
- format: colored-line-number
print-issued-lines: true
print-linter-name: true
# SEE: https://golangci-lint.run/usage/configuration/
linters-settings:
dupl:
# tokens count to trigger issue, 150 by default
threshold: 100
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: 60
# default is 40
statements: 40
gocognit:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 15
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
cyclop:
max-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
lll:
line-length: 120 # 120 is default
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
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
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
varnamelen:
# The longest distance, in source lines, that is being considered a "small scope." (defaults to 5)
# Variables used in at most this many lines will be ignored.
max-distance: 5
# The minimum length of a variable's name that is considered "long." (defaults to 3)
# Variable names that are at least this long will be ignored.
min-name-length: 3
# Check method receivers. (defaults to false)
check-receiver: false
# Check named return values. (defaults to false)
check-return: false
# Check type parameters. (defaults to false)
check-type-param: false
# Ignore "ok" variables that hold the bool return value of a type assertion. (defaults to false)
ignore-type-assert-ok: false
# Ignore "ok" variables that hold the bool return value of a map index. (defaults to false)
ignore-map-index-ok: false
# Ignore "ok" variables that hold the bool return value of a channel receive. (defaults to false)
ignore-chan-recv-ok: false
# Optional list of variable names that should be ignored completely. (defaults to empty list)
ignore-names:
- err
# Optional list of variable declarations that should be ignored completely. (defaults to empty list)
# Entries must be in one of the following forms (see below for examples):
# - for variables, parameters, named return values, method receivers, or type parameters:
# <name> <type> (<type> can also be a pointer/slice/map/chan/...)
# - for constants: const <name>
ignore-decls:
- t testing.T
- f *foo.Bar
- e error
- i int
- const C
- T any
- m map[string]int
- x int
- y int
- w io.Writer
- r io.Reader
- i int64
- f *os.File
- m int
- n int64
- i int32
- c *Context
linters:
enable-all: true
disable:
- exportloopref # is deprecated (since v1.60.2)
- dupword
- wrapcheck
- exhaustruct # mad linter
- depguard
- mnd
issues:
exclude:
- "don't use ALL_CAPS in Go names; use CamelCase" # revive
- "ST1003: should not use ALL_CAPS in Go names; use CamelCase instead" # stylecheck
- "DefaultSettings`? is a global variable" # gochecknoglobals
exclude-dirs:
- vendor/
exclude-files:
- ".*_test.go$"