-
Notifications
You must be signed in to change notification settings - Fork 1
/
.golangci.yaml
202 lines (175 loc) · 8.11 KB
/
.golangci.yaml
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
run:
# concurrency: 2 # available CPU number
timeout: 5m # timeout for analysis
issues-exit-code: 1 # exit code when issue was found
build-tags: [] # list of build tags
tests: true # include tests
skip-dirs: # dirs to skip
- vend
skip-dirs-use-default: true # skip vendor, third_party, test_data
modules-download-mode: readonly # readonly|release|vendor
output:
format: colored-line-number # colored-line-number|line-number|json|tab
print-issued-lines: true # print lines of code with issue
print-linter-name: true # print linter name in the end of issue text
issues:
exclude: [] # list of regexps of issue texts to exclude
exclude-rules: # path, linter, text and source exclude rules
- path: _test\.go
linters:
- gocognit
- gocyclo
exclude-use-default: false # use default exclude patterns
max-issues-per-linter: 0 # maximum issues count per one linter
max-same-issues: 0 # maximum issues count with same text
new: false # show only new issues
new-from-rev: "" # show only new issues created after git revision
new-from-patch: "" # show only new issues created in git patch
linters:
disable-all: false
fast: false
presets: []
enable:
- bodyclose # Checks whether HTTP response body is closed successfully [fast: true, auto-fix: false]
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: true, auto-fix: false]
- funlen # Tool for detection of long functions [fast: true, auto-fix: false]
- ineffassign # Detects when assignments to existing variables are not used [fast: true, auto-fix: false]
- gocognit # Computes and checks the cognitive complexity of functions [fast: true, auto-fix: false]
- goconst # Finds repeated strings that could be replaced by a constant [fast: true, auto-fix: false]
- gocritic # The most opinionated Go source code linter [fast: true, auto-fix: false]
- gocyclo # Computes and checks the cyclomatic complexity of functions [fast: true, auto-fix: false]
- godox # Tool for detection of FIXME, TODO and other comment keywords [fast: true, auto-fix: false]
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true]
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true, auto-fix: true]
- gosimple # Linter for Go source code that specializes in simplifying a code [fast: true, auto-fix: false]
- gosec # Inspects source code for security problems [fast: true, auto-fix: false]
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: true, auto-fix: false]
- lll # Reports long lines [fast: true, auto-fix: false]
- misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true]
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]
- prealloc # Finds slice declarations that could potentially be preallocated [fast: true, auto-fix: false]
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: true, auto-fix: false]
# - structcheck # Finds unused struct fields [fast: true, auto-fix: false]
- stylecheck # Stylecheck is a replacement for golint [fast: true, auto-fix: false]
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code [fast: true, auto-fix: false]
- unconvert # Remove unnecessary type conversions [fast: true, auto-fix: false]
- unparam # Reports unused function parameters [fast: true, auto-fix: false]
- whitespace # Tool for detection of leading and trailing whitespace [fast: true, auto-fix: true]
disable:
- dupl # Tool for code clone detection [fast: true, auto-fix: false]
- gochecknoglobals # Checks that no globals are present in Go code [fast: true, auto-fix: false]
- gochecknoinits # Checks that no init functions are present in Go code [fast: true, auto-fix: false]
- gomnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false]
- wsl # Whitespace Linter - Forces you to use empty lines! [fast: true, auto-fix: false]
linters-settings:
errcheck:
check-type-assertions: true # checking of errors in type assetions
check-blank: false # errors assignment to blank identifier
depguard:
list-type: blacklist
include-go-root: true
packages:
[]
# - net/context
packages-with-error-messages:
# - context: "context instead"
rules:
Main:
deny:
- pkg: golang.org/x/net/context
msg: "use context instead"
- pkg: github.com/pkg/errors
msg: "use errors instead"
dogsled:
max-blank-identifiers: 2
dupl:
threshold: 100 # tokens count to trigger issue
funlen:
lines: 200
statements: 50
gocognit:
min-complexity: 20 # minimal code complexity to report
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
enabled-checks: []
disabled-checks: []
settings: {}
gocyclo:
min-complexity: 10 # minimal code complexity to report
godox:
keywords:
- TODO
- FIXME
gofmt:
simplify: true
goimports:
local-prefixes: vwgroup.dev/slm
golint:
min-confidency: 0
gomnd:
settings:
mnd:
checks: [argument, case, condition, operation, return, assign]
govet:
check-shadowing: true
settings: {} # settings per analyzer
enable-all: false
enable:
- assign # check for useless assignments
- atomic # check for common mistakes using the sync/atomic package
- bools # check for common mistakes involving boolean operators
- buildtag # check that +build tags are well-formed and correctly located
- copylocks # check for locks erroneously passed by value
- errorsas # report passing non-pointer or non-error values to errors.As
- loopclosure # check references to loop variables from within nested functions
- lostcancel # check cancel func returned by context.WithCancel is called
- nilfunc # check for useless comparisons between functions and nil
- printf # check consistency of Printf format strings and arguments
- shift # check for shifts that equal or exceed the width of the integer
- stdmethods # check signature of methods of well-known interfaces
- structtag # check that struct field tags conform to reflect.StructTag.Get
- tests # check for common mistaken usages of tests and examples
- unmarshal # report passing non-pointer or non-interface values to unmarshal
- unreachable # check for unreachable code
- unsafeptr # check for invalid conversions of uintptr to unsafe.Pointer
- unusedresult # check for unused results of calls to some functions
disable-all: false
disable:
- asmdecl # report mismatches between assembly files and Go declarations
- cgocall # detect some violations of the cgo pointer passing rules
- httpresponse # check for mistakes using HTTP responses
lll:
line-height: 120
tab-width: 4
maligned:
suggest-new: true
misspell:
locale: US
ignore-words: []
prealloc:
simple: true # loops that have no returns/breaks/continues/gotos
range-loops: true # preallocation suggestions on range loops
for-loops: true # preallocation suggestions on for loops
nakedret:
max-func-lines: 10
unparam:
check-exported: false
whitespace:
multi-if: true
multi-func: true
wsl:
strict-append: true
allow-assign-and-call: true
allow-multiline-assign: true
allow-trailing-comment: false
force-case-trailing-whitespace: 0