Repository navigation
Expand file tree
/
Copy path.golangci.yml
More file actions
178 lines (178 loc) · 4.79 KB
/
Copy path.golangci.yml
File metadata and controls
178 lines (178 loc) · 4.79 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
# Generated by kennlint config from go.kenn.io/kit/lint/config.
# Put repository-specific additions in the overlay file; do not edit this file by hand.
version: "2"
run:
tests: true
timeout: 10m
allow-parallel-runners: true
go: "1.27"
build-tags:
- fts5
linters:
default: none
enable:
# Correctness
- errcheck
- govet
- staticcheck
- unused
- ineffassign
- errorlint
- errchkjson
- nilerr
- nilnesserr
- bodyclose
- noctx
- durationcheck
- exhaustive
- gocritic
- makezero
- reassign
- copyloopvar
# Modern and idiomatic Go
- modernize
- intrange
- usestdlibvars
- perfsprint
- unconvert
- wastedassign
- predeclared
- errname
- iface
- recvcheck
- mirror
- exptostd
# Tests
- testifylint
- usetesting
- thelper
- tparallel
- testableexamples
# Policy
- forbidigo
- importas
- nolintlint
- misspell
- gocheckcompilerdirectives
# kit analyzers (requires a custom golangci-lint build, see docs)
- kennlint
settings:
errcheck:
check-type-assertions: false
check-blank: false
testifylint:
enable-all: true
disable:
# Identifier names do not prove that an assertion compares encoded data.
- encoded-compare
exhaustive:
default-signifies-exhaustive: true
usetesting:
os-temp-dir: true
context-background: true
context-todo: true
gocritic:
# Only the bug-finding checks; style and opinionated tags are noise.
enabled-tags:
- diagnostic
disabled-tags:
- style
- performance
- experimental
- opinionated
disabled-checks:
- filepathJoin
misspell:
ignore-rules:
- importas
nolintlint:
require-explanation: true
require-specific: true
allow-unused: false
importas:
no-unaliased: true
alias:
- pkg: github.com/stretchr/testify/assert
alias: ""
- pkg: github.com/stretchr/testify/require
alias: ""
forbidigo:
analyze-types: true
forbid:
- pattern: '^t\.(Fatal|Fatalf|Error|Errorf|Fail|FailNow)$'
msg: Use testify assert/require helpers in tests.
- pattern: '^testing\..+\.(Fatal|Fatalf|Error|Errorf|Fail|FailNow)$'
msg: Use testify assert/require helpers in tests.
- pattern: '^exec\.Command$'
msg: Use exec.CommandContext so subprocesses honor cancellation.
- pattern: '^http\.(Get|Post|Head|PostForm)$'
msg: Build the request with http.NewRequestWithContext and a client with timeouts.
- pattern: '^http\.DefaultClient$'
msg: Construct an http.Client with explicit timeouts.
- pattern: '^time\.Local$'
msg: Keep stored and transported times in UTC; convert for display only.
- pattern: '^os\.Chdir$'
msg: Pass explicit paths or use cmd.Dir; the process working directory is shared state.
- pattern: '^errors\.As$'
msg: Use errors.AsType[E] for typed error extraction.
- pattern: '^ioutil\..*$'
msg: io/ioutil is deprecated; use io and os.
- pattern: '^os\.Rename$'
msg: Use atomicfile.Replace from go.kenn.io/kit, or atomicfile.RenameNoReplace when the target must not exist, so a Windows reader that opened the target with share-delete can't block the rename.
custom:
kennlint:
type: module
description: kit analyzers for test discipline, error identity, and route registration.
original-url: go.kenn.io/kit/lint
settings:
errtext:
include-tests: false
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
# Tests may drop errors from cleanup and helper calls.
- linters:
- errcheck
path: _test\.go
# Test files start subprocesses and requests against local fixtures.
- linters:
- forbidigo
path: _test\.go
text: (exec\.Command|http\.(Get|Post|Head|PostForm)|http\.DefaultClient)
# A main package owns process exit and may work without a caller context.
- linters:
- forbidigo
path: ^(cmd/|main\.go)
text: exec\.Command
- linters:
- forbidigo
path: _test\.go
text: atomicfile\.Replace
- linters:
- modernize
text: "omitzero:"
paths:
- third_party$
- builtin$
- examples$
- testdata$
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gofmt
- goimports
- gofumpt
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
- testdata$