-
Notifications
You must be signed in to change notification settings - Fork 116
Expand file tree
/
Copy path.golangci.yml
More file actions
201 lines (189 loc) · 5.92 KB
/
Copy path.golangci.yml
File metadata and controls
201 lines (189 loc) · 5.92 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
version: "2"
run:
# Lint the build-tagged code, not just the untagged subset. The primary
# build uses `fts5 sqlite_vec` (Makefile BUILD_TAGS) and the pgvector
# backend is gated behind `pgvector`; without these tags golangci-lint
# never compiles those files, so lint debt silently accumulates behind
# //go:build constraints (it did — see reviews/codex-pr4-iter3.md).
build-tags:
- fts5
- sqlite_vec
- pgvector
linters:
# Opt-in linter set: only the linters listed under `enable` run. Using
# `default: none` instead of `default: all` means a golangci-lint upgrade
# cannot silently turn on a new linter; it stays off until added here.
default: none
enable:
- arangolint
- asasalint
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- clickhouselint
- copyloopvar
- decorder
- dogsled
- durationcheck
- embeddedstructfieldcheck
- errcheck
- errchkjson
- errname
- errorlint
- exhaustive
- exptostd
- forcetypeassert
- ginkgolinter
- gocheckcompilerdirectives
- gochecksumtype
- goconst
- gocritic
- godoclint
- godot
- goheader
- gomoddirectives
- gomodguard_v2
- goprintffuncname
- gosec
- govet
- grouper
- iface
- importas
- inamedparam
- ineffassign
- intrange
- iotamixing
- loggercheck
- makezero
- mirror
- misspell
- modernize
- musttag
- nakedret
- nilerr
- nilnesserr
- nilnil
- nolintlint
- nosprintfhostport
- perfsprint
- predeclared
- promlinter
- protogetter
- reassign
- recvcheck
- revive
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- testableexamples
- testifylint
- thelper
- unconvert
- unparam
- unused
- usestdlibvars
- usetesting
- wastedassign
- whitespace
- wrapcheck
- zerologlint
# Deliberately not enabled (kept here so an upgrade cannot quietly re-add them):
# style/opinionated: nlreturn, wsl, wsl_v5, varnamelen, ireturn, lll,
# tagliatelle, exhaustruct, nonamedreturns, tagalign, noinlineerr, dupl,
# dupword, fatcontext, funcorder, containedctx, godox, interfacebloat, unqueryvet
# complexity (trust reviewer judgment): funlen, cyclop, gocognit, maintidx, gocyclo, nestif
# project misfit: depguard, mnd, gochecknoglobals, gochecknoinits, testpackage,
# paralleltest, tparallel, gosmopolitan, prealloc, err113, forbidigo
# deprecated: gomodguard (use gomodguard_v2)
# pending dedicated passes: contextcheck, noctx (see follow-up PRs)
settings:
errorlint:
comparison: true
asserts: true
errorf: true
errorf-multi: true
exhaustive:
# `default:` is an acceptable way to handle the missing cases when the
# author has consciously chosen to lump them together.
default-signifies-exhaustive: true
gosec:
excludes:
# G304: file inclusion via variable. msgvault is a CLI that processes
# user-supplied file paths and its own ~/.msgvault/ storage paths;
# gosec can't tell those from untrusted-network input.
- G304
# G301: directory permissions. Same rationale - we operate on the
# user's own directories.
- G301
# G201/G202: SQL string formatting/concatenation. We assemble SQL
# dynamically from our own CTE/view/condition fragments; no caller
# input reaches the format string. Real bind params still use ? / $N.
- G201
- G202
goconst:
# Default is 3; raise to filter noise like TUI keycodes, runtime.GOOS
# comparisons, and rare yes/no prompts. Real candidates (source types,
# SQL table names) recur many more times than the threshold.
min-occurrences: 10
revive:
enable-default-rules: true
rules:
- name: exported
disabled: true
- name: package-comments
disabled: true
# Most "unused" params are imposed by the cobra RunE / http.HandlerFunc /
# tea.Cmd signatures. Renaming each to _ adds churn without value.
- name: unused-parameter
disabled: true
gocritic:
enable-all: true
disabled-tags:
- experimental
- opinionated
disabled-checks:
- hugeParam
- rangeValCopy
- ifElseChain
- singleCaseSwitch
wrapcheck:
# Errors crossing these boundaries don't need extra wrapping.
# Internal-to-internal calls preserve full type info; stdlib SQL/HTTP
# errors are routinely returned verbatim from helpers, and `os`/
# `encoding/json` errors already include the operation in their message.
ignore-package-globs:
- go.kenn.io/msgvault/*
- database/sql
- database/sql/*
- io
- os
- encoding/json
- encoding/csv
- net/http
- path/filepath
extra-ignore-sigs:
# ctx.Err() returns context.Canceled / context.DeadlineExceeded; callers
# use errors.Is to distinguish, which wrapping would break.
- .Err(
exclusions:
rules:
# Tests legitimately repeat fixture strings
- linters: [goconst]
path: _test\.go
# gosec G204/G704: test binaries and URLs are controlled
# G306/G301/G302: test fixture file/dir permissions are not a real risk
# G101: test fixtures use obviously-fake "secret" strings
# G117: marshaled "password"/"access_token" fields are test fixtures
# G703/G122: test paths/walks operate on t.TempDir
# G403: 1024-bit RSA keys are acceptable in tests for speed
# G115: int->byte conversions on known small test inputs
- linters: [gosec]
path: _test\.go
text: "G204|G704|G306|G301|G302|G101|G117|G703|G122|G403|G115"
# staticcheck nil-after-Fatal false positives in tests
- linters: [staticcheck]
path: _test\.go
text: "SA5011"