1
-linters-settings:
2
- errcheck:
3
- exclude-functions:
4
- - fmt.*
5
- - (go.uber.org/zap/zapcore.ObjectEncoder).AddObject
6
- - (go.uber.org/zap/zapcore.ObjectEncoder).AddArray
7
- gci:
8
- sections:
9
- - standard # Standard section: captures all standard packages.
10
- - default # Default section: contains all imports that could not be matched to another section type.
11
- - prefix(github.com/caddyserver/caddy/v2/cmd) # ensure that this is always at the top and always has a line break.
12
- - prefix(github.com/caddyserver/caddy) # Custom section: groups all imports with the specified Prefix.
13
- # Skip generated files.
14
- # Default: true
15
- skip-generated: true
16
- # Enable custom order of sections.
17
- # If `true`, make the section order the same as the order of `sections`.
18
- # Default: false
19
- custom-order: true
20
- exhaustive:
21
- ignore-enum-types: reflect.Kind|svc.Cmd
22
-
1
+version: "2"
2
+run:
3
+ issues-exit-code: 1
4
+ tests: false
5
+output:
6
+ formats:
7
+ text:
8
+ path: stdout
9
+ print-linter-name: true
10
+ print-issued-lines: true
11
linters:
24
- disable-all: true
12
+ default: none
13
enable:
14
- asasalint
15
- asciicheck
23
- errcheck
24
- errname
25
- exhaustive
38
- - gci
39
- - gofmt
40
- - goimports
41
- - gofumpt
26
- gosec
43
- - gosimple
27
- govet
45
- - ineffassign
28
- importas
29
+ - ineffassign
30
- misspell
31
- prealloc
32
- promlinter
33
- sloglint
34
- sqlclosecheck
35
- staticcheck
53
- - tenv
36
- testableexamples
37
- testifylint
38
- tparallel
57
- - typecheck
39
- unconvert
40
- unused
41
- wastedassign
42
- whitespace
43
- zerologlint
63
- # these are implicitly disabled:
64
- # - containedctx
65
- # - contextcheck
66
- # - cyclop
67
- # - depguard
68
- # - errchkjson
69
- # - errorlint
70
- # - exhaustruct
71
- # - execinquery
72
- # - exhaustruct
73
- # - forbidigo
74
- # - forcetypeassert
75
- # - funlen
76
- # - ginkgolinter
77
- # - gocheckcompilerdirectives
78
- # - gochecknoglobals
79
- # - gochecknoinits
80
- # - gochecksumtype
81
- # - gocognit
82
- # - goconst
83
- # - gocritic
84
- # - gocyclo
85
- # - godot
86
- # - godox
87
- # - goerr113
88
- # - goheader
89
- # - gomnd
90
- # - gomoddirectives
91
- # - gomodguard
92
- # - goprintffuncname
93
- # - gosmopolitan
94
- # - grouper
95
- # - inamedparam
96
- # - interfacebloat
97
- # - ireturn
98
- # - lll
99
- # - loggercheck
100
- # - maintidx
101
- # - makezero
102
- # - mirror
103
- # - musttag
104
- # - nakedret
105
- # - nestif
106
- # - nilerr
107
- # - nilnil
108
- # - nlreturn
109
- # - noctx
110
- # - nolintlint
111
- # - nonamedreturns
112
- # - nosprintfhostport
113
- # - paralleltest
114
- # - perfsprint
115
- # - predeclared
116
- # - protogetter
117
- # - reassign
118
- # - revive
119
- # - rowserrcheck
120
- # - stylecheck
121
- # - tagalign
122
- # - tagliatelle
123
- # - testpackage
124
- # - thelper
125
- # - unparam
126
- # - usestdlibvars
127
- # - varnamelen
128
- # - wrapcheck
129
- # - wsl
130
-
131
-run:
132
- # default concurrency is a available CPU number.
133
- # concurrency: 4 # explicitly omit this value to fully utilize available resources.
134
- timeout: 5m
135
- issues-exit-code: 1
136
- tests: false
137
-
138
-# output configuration options
139
-output:
140
- formats:
141
- - format: 'colored-line-number'
142
- print-issued-lines: true
143
- print-linter-name: true
144
-
145
-issues:
146
- exclude-rules:
147
- - text: 'G115' # TODO: Either we should fix the issues or nuke the linter if it's bad
148
- linters:
149
- - gosec
150
- # we aren't calling unknown URL
151
- - text: 'G107' # G107: Url provided to HTTP request as taint input
152
- linters:
153
- - gosec
154
- # as a web server that's expected to handle any template, this is totally in the hands of the user.
155
- - text: 'G203' # G203: Use of unescaped data in HTML templates
156
- linters:
157
- - gosec
158
- # we're shelling out to known commands, not relying on user-defined input.
159
- - text: 'G204' # G204: Audit use of command execution
160
- linters:
161
- - gosec
162
- # the choice of weakrand is deliberate, hence the named import "weakrand"
163
- - path: modules/caddyhttp/reverseproxy/selectionpolicies.go
164
- text: 'G404' # G404: Insecure random number source (rand)
165
- linters:
166
- - gosec
167
- - path: modules/caddyhttp/reverseproxy/streaming.go
168
- text: 'G404' # G404: Insecure random number source (rand)
169
- linters:
170
- - gosec
171
- - path: modules/logging/filters.go
172
- linters:
173
- - dupl
174
- - path: modules/caddyhttp/matchers.go
175
- linters:
176
- - dupl
177
- - path: modules/caddyhttp/vars.go
178
- linters:
179
- - dupl
180
- - path: _test\.go
181
- linters:
182
- - errcheck
44
+ settings:
45
+ staticcheck:
46
+ checks: ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-QF1006", "-QF1008"] # default, and exclude 1 more undesired check
47
+ errcheck:
48
+ exclude-functions:
49
+ - fmt.*
50
+ - (go.uber.org/zap/zapcore.ObjectEncoder).AddObject
51
+ - (go.uber.org/zap/zapcore.ObjectEncoder).AddArray
52
+ exhaustive:
53
+ ignore-enum-types: reflect.Kind|svc.Cmd
54
+ exclusions:
55
+ generated: lax
56
+ presets:
57
+ - comments
58
+ - common-false-positives
59
+ - legacy
60
+ - std-error-handling
61
+ rules:
62
+ - linters:
63
+ - gosec
64
+ text: G115 # TODO: Either we should fix the issues or nuke the linter if it's bad
65
+ - linters:
66
+ - gosec
67
+ text: G107 # we aren't calling unknown URL
68
+ - linters:
69
+ - gosec
70
+ text: G203 # as a web server that's expected to handle any template, this is totally in the hands of the user.
71
+ - linters:
72
+ - gosec
73
+ text: G204 # we're shelling out to known commands, not relying on user-defined input.
74
+ - linters:
75
+ - gosec
76
+ # the choice of weakrand is deliberate, hence the named import "weakrand"
77
+ path: modules/caddyhttp/reverseproxy/selectionpolicies.go
78
+ text: G404
79
+ - linters:
80
+ - gosec
81
+ path: modules/caddyhttp/reverseproxy/streaming.go
82
+ text: G404
83
+ - linters:
84
+ - dupl
85
+ path: modules/logging/filters.go
86
+ - linters:
87
+ - dupl
88
+ path: modules/caddyhttp/matchers.go
89
+ - linters:
90
+ - dupl
91
+ path: modules/caddyhttp/vars.go
92
+ - linters:
93
+ - errcheck
94
+ path: _test\.go
95
+ paths:
96
+ - third_party$
97
+ - builtin$
98
+ - examples$
99
+formatters:
100
+ enable:
101
+ - gci
102
+ - gofmt
103
+ - gofumpt
104
+ - goimports
105
+ settings:
106
+ gci:
107
+ sections:
108
+ - standard # Standard section: captures all standard packages.
109
+ - default # Default section: contains all imports that could not be matched to another section type.
110
+ - prefix(github.com/caddyserver/caddy/v2/cmd) # ensure that this is always at the top and always has a line break.
111
+ - prefix(github.com/caddyserver/caddy) # Custom section: groups all imports with the specified Prefix.
112
+ custom-order: true
113
+ exclusions:
114
+ generated: lax
115
+ paths:
116
+ - third_party$
117
+ - builtin$
118
+ - examples$