-
Notifications
You must be signed in to change notification settings - Fork 188
Expand file tree
/
Copy path.golangci.yml
More file actions
183 lines (183 loc) · 5.83 KB
/
Copy path.golangci.yml
File metadata and controls
183 lines (183 loc) · 5.83 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
180
181
182
183
version: "2"
issues:
new-from-rev: origin/main
fix: true
run:
tests: false
linters:
enable:
- dupl
- staticcheck
- wastedassign
- unused
- usetesting
- usestdlibvars
- unconvert
- grouper
- gocritic
- revive
- gosec
- misspell
- whitespace
- testifylint
- promlinter
- modernize
- intrange
- exptostd
- errorlint
- gocheckcompilerdirectives
- mirror
- importas
- perfsprint
disable:
- errcheck
- goconst # disable due to spate of findings unrelated to the PR coming through
settings:
dupl:
threshold: 150 # default is 100; have brought current codebase down to 75, but leaving default at 150 for now
lll:
line-length: 180
staticcheck:
checks:
- all # default
- -ST1000 # default
- -ST1003 # default
- -ST1016 # default
- -ST1020 # default
- -ST1021 # default
- -ST1022 # default
- -QF1008 # prefer referencing embedded field by full reference
gocritic:
disabled-checks:
- unslice # stylistic choice, ok with slice[:] references
- ifElseChain # false positives / prefers switch statements
gosec:
excludes:
- G401 # MD5 & SHA1 adequate for non-cryptographic use cases
- G501 # MD5 & SHA1, again
- G505 # MD5 & SHA1, again
- G704 # False positive: trickster is a proxy and must interact with configured backends, so it must be able to make requests to arbitrary URLs
- G705 # XSS checks are not helpful for trickster's carefully constructed responses, this has many false positives at this time; revisit later
revive:
enable-all-rules: true
rules:
- name: unhandled-error
arguments: # Allow skipping errors for the following functions
- fmt.Print
- fmt.Println
- fmt.Printf
- fmt.Fprintf
- fmt.Fprint
- strings.Builder.WriteString
- os.Remove
- encoding/pem.Encode
- strings.Builder.WriteByte
- strings.Builder.Write
- bytes.Buffer.WriteString
- bytes.Buffer.WriteByte
- text/tabwriter.Writer.Write
- text/tabwriter.Writer.Flush
- io.Writer.Write
- io.Closer.Close
- io.Copy
- bytes.Buffer.Write
- net/http.ResponseWriter.Write
- mime/multipart.Writer.Close
- mime/multipart.Writer.SetBoundary
- net/http.Request.ParseForm
- github.com/klauspost/compress/gzip.Writer.Close
- github.com/klauspost/compress/flate.Writer.Write
- github.com/klauspost/compress/flate.Writer.Close
- net/http.Request.ParseMultipartForm
- handler.ResponseEncoder.Close
- config.Config.setDefaults
- encoding/csv.Writer.Write
- os.File.Close
- name: exported
arguments:
- disableStutteringCheck
- name: unused-parameter
disabled: true # very noisy, lots of code with unused parameters; revisit later
- name: line-length-limit
disabled: true # prefer lll linter instead
- name: add-constant
disabled: true # very noisy, revisit later
- name: empty-lines
disabled: true # stylistic choice, ok with empty lines
- name: cognitive-complexity
disabled: true # too noisy, revisit later
- name: time-naming
disabled: true # stylistic choice, warnings not helpful
- name: cyclomatic
disabled: true # not helpful, perhaps later
- name: max-public-structs
disabled: true # not useful
- name: function-result-limit
disabled: true # not useful
- name: confusing-results
disabled: true # not useful
- name: function-length
disabled: true # not useful
- name: unchecked-type-assertion
disabled: true # not helpful, we have many of these; revisit later
- name: unused-receiver
disabled: true # not helpful, revisit later
- name: flag-parameter
disabled: true # not helpful, revisit later
- name: unexported-naming
disabled: true # not helpful, false positives
- name: redefines-builtin-id
disabled: true # not helpful
- name: argument-limit
disabled: true # not helpful
- name: confusing-naming
disabled: true # not helpful, revisit later
- name: use-any
disabled: true # too many hits, revisit in standalone PR
- name: deep-exit
disabled: true # not helpful
- name: max-control-nesting
disabled: true # not helpful
- name: defer
disabled: true # not helpful
- name: struct-tag
disabled: true # not helpful
- name: bare-return
disabled: true # stylistic choice, ok with bare returns
- name: import-shadowing
disabled: true # not helpful; considering a stylistic choice
- name: enforce-switch-style
disabled: true # disable 'switch must have a default case clause (revive)' checks
- name: var-naming
disabled: true # disable 'meaningless package names' (e.g., types, util, etc.) checks
- name: package-naming
disabled: true # disable 'bad package name' (e.g., types, util, etc.) checks
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- goimports
- gofumpt
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
settings:
gci:
custom-order: true
sections:
- standard
- prefix(github.com/trickstercache)
- default