-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy path.golangci.yml
More file actions
172 lines (158 loc) · 4.57 KB
/
Copy path.golangci.yml
File metadata and controls
172 lines (158 loc) · 4.57 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
version: "2"
run:
go: "1.27"
tests: true
timeout: 5m
formatters:
enable:
- gofmt
- goimports
settings:
goimports:
local-prefixes:
- github.com/dimetron/pi-go
linters:
default: none
enable:
# Default linters.
- errcheck
- govet
- ineffassign
- staticcheck
- unused
# Style and bugs.
- bodyclose
- copyloopvar
- durationcheck
- errname
- errorlint
- fatcontext
# Complexity linters (cyclop / gocyclo / gocognit) are intentionally NOT enabled.
# They are configured below as "nice to have" and can be run on demand via:
# golangci-lint run --enable=cyclop,gocyclo,gocognit ./...
# See docs/review.md for the current inventory of complexity hotspots.
- misspell
- nilerr
- revive
- unconvert
- wastedassign
exclusions:
# Built-in exclusion presets (e.g. test helpers, generated code).
presets:
- std-error-handling
# tmp/ is a scratch area for vendored third-party repos (SDK copies,
# claude-mem, …) kept for reference. Not our code — never lint it.
# Unanchored on purpose: golangci-lint cache entries can carry paths from
# sibling worktrees (same caveat as the hack/ exclusion below).
paths:
- tmp/
rules:
# Test files: relax errcheck, bodyclose, nilerr, unusedwrite, SA5011.
- path: _test\.go
linters:
- errcheck
- bodyclose
- nilerr
- cyclop
- gocyclo
- gocognit
- path: _test\.go
linters:
- staticcheck
text: "SA5011"
- path: _test\.go
text: unusedwrite
# Research directory is experimental.
- path: ^research/
linters:
- errcheck
- bodyclose
- nilerr
- revive
- staticcheck
- govet
- misspell
- errorlint
- unconvert
- unused
- wastedassign
- cyclop
- gocyclo
- gocognit
# hack/ is a scratch area for ad-hoc E2E probes that vendor upstream
# example servers (e.g. the MCP everything server). The vendored code
# deliberately exercises APIs that the upstream SDK is deprecating
# (SA1019) so we can detect SDK breakage early. Don't lint it.
#
# Deliberately unanchored: golangci-lint caches results by content but
# prints the path recorded when the entry was written, so a cache hit
# populated from a sibling worktree surfaces as
# ../<other-worktree>/hack/... . An ^-anchored pattern misses those and
# the excluded issues resurface as hard pre-commit failures.
- path: hack/
linters:
- staticcheck
# ADK tool handlers return errors inside result structs, not as Go errors.
- path: internal/tools/
linters:
- nilerr
# LSP/hook/callback wrappers and miners intentionally swallow errors into result fields.
- path: internal/(lsp|cli|memory|tui|palace)/
linters:
- nilerr
# Package comments: internal packages don't need them.
- linters:
- staticcheck
text: "ST1000"
settings:
errcheck:
check-type-assertions: true
exclude-functions:
- (io.Closer).Close
- (*os.File).Close
- (net/http.ResponseWriter).Write
- fmt.Fprintf
- fmt.Fprintln
- (strings.Builder).WriteString
- (strings.Builder).Write
govet:
enable-all: true
disable:
- fieldalignment # too noisy, micro-optimisation
- shadow # common in Go, intentional re-declarations
revive:
rules:
- name: blank-imports
- name: context-as-argument
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
disabled: true # too strict for internal packages
- name: increment-decrement
- name: var-naming
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: empty-block
disabled: true # channel drain pattern (for range ch {}) is idiomatic
- name: superfluous-else
- name: unreachable-code
staticcheck:
checks: ["all"]
cyclop:
max-complexity: 15
package-average: 10.0
gocyclo:
min-complexity: 15
gocognit:
min-complexity: 20
misspell:
locale: US
issues:
max-issues-per-linter: 50
max-same-issues: 5