-
Notifications
You must be signed in to change notification settings - Fork 381
Expand file tree
/
Copy path.golangci.yaml
More file actions
172 lines (172 loc) 路 4.77 KB
/
Copy path.golangci.yaml
File metadata and controls
172 lines (172 loc) 路 4.77 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"
# Without these, every `//go:build integration` and `//go:build e2e` file is
# invisible to golangci-lint.
run:
build-tags:
- integration
- e2e
issues:
max-issues-per-linter: 0
max-same-issues: 0
linters:
default: standard
enable:
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- copyloopvar
- decorder
- durationcheck
- embeddedstructfieldcheck
- errchkjson
- errname
- errorlint
- exhaustive
- exptostd
- forbidigo
- forcetypeassert
- gocheckcompilerdirectives
- gochecknoinits
- gochecksumtype
- goconst
- gocritic
- gosec
- govet
- grouper
- iface
- importas
- inamedparam
- ineffassign
- intrange
- loggercheck
- maintidx
- makezero
- mirror
- misspell
- musttag
- nakedret
- nilerr
- nilnesserr
- nilnil
- noctx
- nolintlint
- nosprintfhostport
- perfsprint
- promlinter
- protogetter
- reassign
- recvcheck
- revive
- sloglint
- spancheck
- staticcheck
- tagalign
- testableexamples
- testifylint
- tparallel
- unconvert
- unparam
- unused
- usestdlibvars
- usetesting
- wastedassign
- whitespace
- wrapcheck
settings:
gosec:
excludes:
- G204 # subprocess with variables is expected for git/opencode CLI wrappers
- G702 # command injection via taint - controlled CLI inputs
- G705 # XSS not applicable to CLI stderr output
dupl:
# Token threshold for duplication detection
# Lower = more sensitive (catches smaller duplicates)
# Default is 150. We use 75 for lint (blocks CI), `mise run dup` uses 50 (advisory)
threshold: 75
errcheck:
check-type-assertions: true
check-blank: true
wrapcheck:
# Errors from the generated control-plane client are mapped centrally
# by renderCoreError (cmd/entire/cli/corecmd.go), which extracts the
# RFC 7807 problem detail via errors.As. Per-call-site wrapping would
# only be unwrapped again, so the command closures return coreapi
# errors verbatim.
#
# checkpointpolicy.EnsureCanReadVersion already returns a clean,
# user-facing message (including the checkpoint ID and version), and
# callers classify it via IsUnsupportedVersion. Wrapping would obscure
# that purpose-built message, so call sites return it verbatim.
ignore-package-globs:
- github.com/entireio/cli/internal/coreapi
- github.com/entireio/cli/cmd/entire/cli/checkpointpolicy
forbidigo:
analyze-types: true
forbid:
- pattern: '^os\.Getwd$'
msg: "os.Getwd() breaks when running from subdirectories - use paths.RepoRoot() for git-relative paths"
pkg: '^os$'
- pattern: '^.*\.Reset$'
msg: "go-git Reset deletes .gitignored dirs - use HardResetWithProtection() from common.go"
pkg: 'github\.com/go-git/go-git'
- pattern: '^.*\.Checkout$'
msg: "go-git Checkout deletes .gitignored dirs - use CheckoutBranch() from git_operations.go"
pkg: 'github\.com/go-git/go-git'
- pattern: '^.*\.(Print|Println|Printf)$'
msg: "cobra's Print* writes to OutOrStderr (stderr in production); use fmt.Fprint*(cmd.OutOrStdout(), ...)"
pkg: 'github\.com/spf13/cobra'
govet:
enable-all: true
disable:
- fieldalignment
- shadow
nolintlint:
require-explanation: true
require-specific: true
sloglint:
attr-only: true
testifylint:
enable-all: true
unparam:
check-exported: true
exclusions:
presets:
- comments
- std-error-handling
rules:
- path: _test\.go
linters:
- gosec
- wrapcheck
- forbidigo
- path: ^e2e/
linters:
- errcheck
- gochecknoinits
- goconst
- gosec
- noctx
- revive
- usetesting
- wrapcheck
# Test harness that happens not to end in _test.go, so the rules above
# miss it. Same exemption `^e2e/` already gets for its support files.
- path: ^cmd/entire/cli/integration_test/
linters:
- gosec
- path: ^test/workloads/
linters:
- wrapcheck
- path: ^internal/sim/
linters:
- wrapcheck
# configloader.go is a thin os-backed billy.Basic adapter. It must return
# raw os errors unwrapped so go-git's os.IsNotExist() fall-through (for
# absent config files) keeps working; wrapping would break it.
- path: ^cmd/entire/cli/checkpoint/configloader\.go$
linters:
- wrapcheck
- text: "`strat` is a misspelling"
linters:
- misspell