-
Notifications
You must be signed in to change notification settings - Fork 1
/
.golangci.yml
163 lines (141 loc) · 5.09 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
# This file contains all available configuration options with their default values
# Options for analysis running
run:
go: '1.21'
# include test files or not, default is true
tests: false
# which dirs to skip: they won't be analyzed;
# can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but next dirs are always skipped independently
# from this option's value:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
#skip-dirs:
# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize
# autogenerated files. If it's not please let us know.
skip-files:
- ".*\\_test.go$"
# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: colored-line-number
# print lines of code with issue, default is true
print-issued-lines: true
# print linter name in the end of issue text, default is true
print-linter-name: true
# all available settings of specific linters
# Check here for configuration options: https://golangci-lint.run/usage/linters/#errcheck
linters-settings:
errcheck:
check-type-assertions: true
check-blank: true
funlen:
# Ignore line counts, not helpful
lines: -1
# No more than 20 statments per function
statements: 20
goconst:
ignore-tests: true
govet:
check-shadowing: true
# settings per analyzer
settings:
printf: # analyzer name, run `go tool vet help` to see all analyzers
funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
golint:
# minimal confidence for issues, default is 0.8
min-confidence: 0.8
lll:
line-length: 100
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
locale: UK
nakedret:
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
# Disabling naked returns
max-func-lines: 0
godox:
# report any comments starting with keywords, this is useful for TODO or FIXME comments that
# might be left in the code accidentally and should be resolved before merging
keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting
# We're allowing TODO as commits may stretch over multiple things to be done
- NOTE
- OPTIMIZE # marks code that should be optimized before merging
- HACK # marks hack-arounds that should be removed before merging
- Bug
- FIXME
dogsled:
# checks assignments with too many blank identifiers; default is 2
max-blank-identifiers: 2
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
linters:
enable-all: false
enable:
- asasalint
- bodyclose
- contextcheck
- errcheck
- errorlint
- exportloopref
- funlen
- goconst
- gomnd
- gosimple
# This has caused problems in the past flagging irrelevant code
# Can be disabled here if starts doing the same thing in this project
- gosec
- govet
- ineffassign
- megacheck
- nakedret
- rowserrcheck
- prealloc
- staticcheck
- stylecheck
- testpackage
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
disable-all: false
disable:
# Does not work as expected, suppose to order imports, complains about random parts of structs
- gci
# Not required for small utility application
- lll
# We want to keep the alphabetic order in structures
# This would lead to smaller structs in memory, but not needed for our project
- maligned
# scopelint has been deprecated, replaced by exportloopref
- scopelint
# Seems to misbehave, reporting errors in built-in Go libraries
- musttag
# Deprecated, replaced by unused
- structcheck
# Deprecated, replaced by unused
- varcheck
# Deprecated, replaced by unused
- deadcode
presets:
- bugs
- unused
fast: false