-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Expand file tree
/
Copy path.golangci.yaml
More file actions
179 lines (175 loc) · 4.47 KB
/
.golangci.yaml
File metadata and controls
179 lines (175 loc) · 4.47 KB
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
version: "2"
run:
timeout: 7m
linters:
enable:
- dogsled
- errcheck
- gocritic
- govet
- gocyclo
- ineffassign
- misspell
- nakedret
- revive
- staticcheck
- unconvert
- unparam
- unused
settings:
staticcheck:
checks:
# Below is the default set
- "all"
- "-ST1000"
- "-ST1003"
- "-ST1016"
- "-ST1020"
- "-ST1021"
- "-ST1022"
# Omit embedded fields from selector expression
- "-QF1008"
revive:
enable-all-rules: true
rules:
# See https://revive.run/r
##### P0: we should do it ASAP.
- name: max-control-nesting
arguments: [7]
- name: deep-exit
disabled: true
- name: unchecked-type-assertion
disabled: true
- name: bare-return
disabled: true
- name: import-shadowing
disabled: true
- name: use-errors-new
disabled: true
##### P1: consider making a dent on these, but not critical.
- name: argument-limit
arguments: [12]
- name: unnecessary-stmt
disabled: true
- name: defer
disabled: true
- name: confusing-naming
disabled: true
- name: early-return
disabled: true
- name: function-result-limit
arguments: [7]
- name: function-length
arguments: [0, 400]
- name: cyclomatic
arguments: [100]
- name: unhandled-error
disabled: true
- name: cognitive-complexity
arguments: [197]
##### P2: nice to have.
- name: max-public-structs
arguments: [25]
- name: confusing-results
disabled: true
- name: comment-spacings
disabled: true
- name: use-any
disabled: true
- name: empty-lines
disabled: true
- name: package-comments
disabled: true
- name: exported
disabled: true
###### Permanently disabled. Below have been reviewed and vetted to be unnecessary.
- name: line-length-limit
disabled: true
- name: nested-structs
disabled: true
- name: flag-parameter
disabled: true
- name: unused-parameter
disabled: true
- name: unused-receiver
disabled: true
- name: add-constant
disabled: true
###### To be determined, this is a rule with differences.
- name: import-alias-naming
disabled: true
- name: unexported-naming
disabled: true
- name: struct-tag
disabled: true
- name: redundant-import-alias
disabled: true
gocritic:
# See https://go-critic.com/overview.html
disabled-checks:
# Below are normally enabled by default, but we do not pass
- appendAssign
- ifElseChain
- unslice
- badCall
- assignOp
- commentFormatting
- captLocal
- singleCaseSwitch
- wrapperFunc
- elseif
- regexpMust
- deprecatedComment
enabled-checks:
# Below used to be enabled, but we do not pass anymore
# - paramTypeCombine
# - octalLiteral
# - unnamedResult
# - equalFold
# - sloppyReassign
# - emptyStringTest
# - hugeParam
# - appendCombine
# - stringXbytes
# - ptrToRefParam
# - commentedOutCode
# - rangeValCopy
# - methodExprCall
# - yodaStyleExpr
# - typeUnparen
# We enabled these and we pass
- nilValReturn
- weakCond
- indexAlloc
- rangeExprCopy
- boolExprSimplify
- commentedOutImport
- docStub
- emptyFallthrough
- hexLiteral
- typeAssertChain
- unlabelStmt
- builtinShadow
- importShadow
- initClause
- nestingReduce
- unnecessaryBlock
exclusions:
paths:
# we generally dont wanna touch or lint the Third_party code, it is basically like a fork for code that we can not import.
# but have to copy/paste
- third_party
# Skip test files
- '(.+)_test\.go'
rules:
# I think this check is meaningless.
- path: '(.+)\.go$'
text: "Error return value of `.*` is not checked"
linter: errcheck
formatters:
enable:
- gofmt
- goimports
exclusions:
paths:
- third_party