forked from bojieli/agentreach
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
130 lines (119 loc) · 4.73 KB
/
Copy path.golangci.yml
File metadata and controls
130 lines (119 loc) · 4.73 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
version: "2"
# reach's linting is chosen for one thing above style: this program runs shell
# commands on machines the operator does not control, holds their credentials,
# and is trusted not to touch anything it was not asked to. The linters enabled
# here are the ones that catch that class of mistake — an unchecked error that
# turns a failed remote write into a silent success, a context that is never
# cancelled, a channel left open on someone else's server.
run:
timeout: 5m
build-tags:
- integration
linters:
enable:
# An ignored error is how a failed remote write becomes a success the agent
# believes in. This is the most important linter in the list.
- errcheck
- govet
- staticcheck
- ineffassign
- unused
# Every long-lived channel and process reach opens must be closed; one left
# behind is a live connection to a machine the operator wanted untouched.
- bodyclose
- noctx
# Correctness traps rather than style.
- errorlint
- nilerr
- copyloopvar
- durationcheck
- makezero
- unconvert
- wastedassign
- gosec
- misspell
- revive
settings:
errcheck:
check-type-assertions: true
# Deliberate best-effort cleanups are written as `_ = x.Close()`, which is
# visible at the call site rather than hidden in this file.
exclude-functions:
- (io.Closer).Close
- os.Remove
- os.RemoveAll
gosec:
excludes:
# G115: integer conversions. Every remaining one is a protocol length
# or offset bounded by an explicit limit checked at the call site —
# maxFrame, or a chunk size — rather than a value the far end chose.
- G115
# G304: opening a file whose path came from a variable is this program's
# entire job. Containment is enforced where it matters (mirror.Local)
# and tested, rather than asserted by a linter that cannot see it.
- G304
# G702/G703: taint analysis flags every command and path reach builds,
# which is all of them. Quoting goes through transport.ShellQuote and is
# covered by tests for shell metacharacters and awkward filenames; a
# blanket rule here would produce a wall of nolint comments that hides
# the cases worth reading.
- G702
- G703
# G301: the opencode tool directory must be readable by opencode.
- G301
# G204: reach's entire purpose is running commands built from variables.
# Every construction site quotes through transport.ShellQuote and is
# covered by tests for shell metacharacters; a blanket ban would produce
# a wall of nolint comments that hides the cases worth looking at.
- G204
# G306/G302: file permissions are chosen deliberately throughout and
# asserted by the conformance suite, not by a linter's default.
- G306
- G302
misspell:
locale: UK
# Words reach does not get to spell. `initialize`/`initialized` are the
# JSON-RPC method and notification names in codex's exec-server protocol,
# and `visualize` is the literal name of a Gemini CLI tool in the
# deny-list. These appear in wire strings and in the prose that explains
# them; respelling either to UK English would rename a protocol message
# and break the seam it describes.
ignore-rules:
- initialize
- initialized
- visualize
staticcheck:
checks:
- all
# ST1005 requires error strings to be lowercase and unpunctuated,
# because Go errors are usually fragments wrapped into a larger
# sentence. reach's are not: they are the terminal message an operator
# or an agent reads, and several are deliberately multi-sentence
# instructions on what to do next — "it changed on the target since it
# was read. Re-read the file and redo the change." Mangling those into
# fragments to satisfy the rule would make the tool worse at the one
# thing CONTRIBUTING asks of its errors.
- "-ST1005"
revive:
rules:
- name: exported
- name: package-comments
- name: unused-parameter
- name: redefines-builtin-id
# Disabled for the same reason as ST1005.
- name: error-strings
disabled: true
exclusions:
rules:
# Test helpers legitimately ignore errors while cleaning up, and the
# conformance suite deliberately drives failure paths.
- path: _test\.go
linters: [errcheck, gosec, noctx, errorlint]
- path: internal/fileops/fileopstest/
linters: [errcheck, gosec, revive, errorlint]
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gofmt