-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.golangci.yml
232 lines (208 loc) · 5.59 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
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# Copyright (c) 2019-present Sven Greb <[email protected]>
# This source code is licensed under the MIT license found in the license file.
# Configuration for golangci-lint.
# See https://golangci-lint.run/usage/configuration for more details.
issues:
# Prevent linter rules/issues, that are explicitly enabled by this configuration, to be ignored due to golangci-lint's
# set of issues that are ignored by default.
exclude-use-default: false
exclude-rules:
# Prevent issues on `go generate` command directive lines.
- linters:
- lll
source: "^//go:generate "
# Allow URLs with any length.
- linters:
- lll
source: (https?):\/\/[^\s\/$.?#].[^\s]*
# Exclude some linters from running on test files.
- path: _test\.go
linters:
- gocyclo
- gosec
max-issues-per-linter: 0
max-same-issues: 0
linters:
disable-all: true
enable:
- bidichk
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- errorlint
- exhaustive
- exportloopref
- gochecknoinits
- goconst
- gocritic
- gocyclo
- gofmt
- gofumpt
- goheader
- goimports
- gomnd
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- nilnil
- noctx
- nolintlint
- revive
- staticcheck
- structcheck
- stylecheck
- tenv
- tparallel
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
- wrapcheck
# Run all linters, not only fast ones.
fast: false
# Configurations for enabled linters.
# See https://golangci-lint.run/usage/linters for more details.
linters-settings:
depguard:
list-type: blacklist
# Do not check against the standard library.
include-go-root: false
packages:
- golang.org/x/net/context
packages-with-error-message:
- golang.org/x/net/context: "As of Go 1.7 this package is available in the standard library under the name context: golang.org/pkg/context"
dupl:
# Minimum count of tokens before triggering as duplicate code.
threshold: 100
errcheck:
# Report about not checking of errors in type assertions.
# Example: `a := b.(CustomStruct)`
check-type-assertions: true
errorlint:
# Prevent false-positive matches for code lines that explicitly do not wrap the error to prevent it become part of
# the public API.
# See https://github.com/svengreb/tmpl-go/issues/39 and https://github.com/svengreb/tmpl-go/issues/64 for details.
errorf: false
gci:
# A comma-separated list of prefixes for local package imports to be put after 3rd-party packages.
local-prefixes: github.com/svengreb/wand
goconst:
min-len: 2
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- performance
- style
gofumpt:
extra-rules: true
lang-version: "1.17"
goheader:
values:
const:
AUTHOR: Sven Greb
YEAR: 2019-present
regexp:
EMAIL: .*@svengreb\.de
template: |-
Copyright (c) {{ YEAR }} {{ AUTHOR }} <{{ EMAIL }}>
This source code is licensed under the MIT license found in the license file.
goimports:
# A comma-separated list of prefixes for local package imports to be put after 3rd-party packages.
local-prefixes: github.com/svengreb/wand
gomnd:
settings:
mnd:
# The list of enabled checks.
# See https://github.com/tommy-muehle/go-mnd/#checks for more details.
checks: argument,assign,case,condition,operation,return
govet:
check-shadowing: true
importas:
execSupport: github.com/svengreb/wand/internal/support/exec
osSupport: github.com/svengreb/wand/internal/support/os
lll:
line-length: 160
tab-width: 2
misspell:
locale: US
ignore-words:
- inkpen
- magefile
- nib
# See https://github.com/mgechev/revive#available-rules and
# https://github.com/mgechev/revive#recommended-configuration for more details.
revive:
ignore-generated-header: false
severity: warning
error-code: 1
# Ignore linting errors with less than 0.2 confidence.
confidence: 0.2
rules:
- name: atomic
- name: context-as-argument
- name: deep-exit
- name: defer
- name: duplicated-imports
severity: error
- name: early-return
- name: empty-block
- name: empty-lines
- name: error-naming
- name: error-return
severity: error
- name: error-strings
- name: errorf
- name: exported
arguments:
- checkPrivateReceivers
- disableStutteringCheck
- name: identical-branches
- name: if-return
- name: import-shadowing
severity: error
- name: increment-decrement
- name: indent-error-flow
- name: range
- name: receiver-naming
- name: redefines-builtin-id
severity: error
- name: string-of-int
severity: error
- name: superfluous-else
- name: time-naming
- name: unconditional-recursion
- name: unexported-naming
- name: unexported-return
- name: unhandled-error
- name: unreachable-code
- name: useless-break
- name: var-declaration
tagliatelle:
case:
use-field-name: true
rules:
bson: goCamel
json: goCamel
mapstructure: snake
xml: goCamel
yaml: goCamel
wrapcheck:
ignorePackageGlobs:
- github.com/svengreb/wand/*
# Options for analysis runs.
run:
deadline: 15m
service:
golangci-lint-version: 1.43.x