-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
164 lines (157 loc) Β· 4.22 KB
/
.golangci.yml
File metadata and controls
164 lines (157 loc) Β· 4.22 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
# golangci-lint configuration for coily.
#
# Strict-ish. Leans on cyclomatic complexity checks because coily is a security
# boundary and tangled branchy code is where the policy holes live.
#
# Run with `make lint`. Auto-fix with `make lint-fix`.
version: "2"
run:
timeout: 3m
tests: true
modules-download-mode: readonly
build-tags:
- dev
- prod
- integration
linters:
default: none
enable:
# Correctness.
- errcheck
- govet
- ineffassign
- staticcheck
- unused
- gosec
# Style.
- misspell
- unconvert
- unparam
- whitespace
# Complexity.
- gocyclo
- gocognit
- cyclop
- funlen
- nestif
# Reduce surprise.
- gocritic
- revive
- asasalint
- asciicheck
- bidichk
- bodyclose
- errorlint
- exhaustive
- nilerr
- nilnil
- predeclared
- wastedassign
settings:
gocyclo:
min-complexity: 12
gocognit:
min-complexity: 20
cyclop:
max-complexity: 12
package-average: 8
funlen:
lines: 100
statements: 50
nestif:
min-complexity: 5
# goconst was disabled because in this codebase the strings it flagged
# were flag-name map keys ("--host", "--user", "--since") used to build
# audit-log argv summaries, and config-shape keys ("hooks", "command",
# "Bash") used to construct settings.json payloads. Both are at the
# boundary between Go code and an external string contract; pulling
# them into a constant adds an indirection without making the literal
# safer to change. Re-enable if the codebase grows truly-magic strings
# (sentinel values, protocol tokens) that goconst would catch.
gosec:
excludes:
# G204 fires on every exec.CommandContext(ctx, bin, argv...) even with
# argv properly constructed. We validate in pkg/policy. This is the
# whole point of the tool.
- G204
# G301/G302/G306 (file permissions): we manage perms deliberately per
# call site. The audit log is 0600, settings files 0600, dev fixtures
# 0644. Trust the per-site choice over a blanket rule.
- G301
- G302
- G304
- G306
errcheck:
check-type-assertions: false
exclude-functions:
- (*os.File).Close
- os.Remove
- os.RemoveAll
revive:
rules:
- name: blank-imports
- name: context-as-argument
- name: error-return
- name: error-strings
- name: error-naming
- name: if-return
- name: increment-decrement
- name: var-naming
- name: var-declaration
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unused-parameter
- name: unreachable-code
- name: redefines-builtin-id
# Deliberately disabled: "exported" and "package-comments" are too
# noisy for a project that is still expanding surface area. Re-enable
# once the command surface stabilizes.
exclusions:
rules:
# Generated files: mostly mechanical, skip most checks.
- path: "_generated\\.go$"
linters:
- cyclop
- funlen
- gocognit
- gocyclo
- revive
- gocritic
- goconst
- dupl
- unparam
- unused
- misspell
- errorlint
- staticcheck
# Tests: relaxed complexity, long table-driven cases are fine.
- path: "_test\\.go$"
linters:
- funlen
- gocognit
- gocyclo
- cyclop
- gocritic
- goconst
- errcheck
- gosec
# Dev tooling (subcli-scope, install-skill) legitimately reads/writes
# user-controlled paths. Suppress the noisier gosec file-path rules.
- path: "cmd/subcli-scope/"
text: "G30[14-6]:"
- path: "cmd/gen-passthrough/"
text: "G(30[14-6]|703):"
- path: "cmd/coily/install_skill_dev\\.go$"
text: "G301:"
formatters:
enable:
- gofmt
- goimports
issues:
max-same-issues: 20