Commit f0eccb8
committed
fix(purchase): extract failed-account save helper to stay under gocyclo:10
The new `if saveErr != nil` audit-loss branch added to executeForAccount on
this PR pushed its cyclomatic complexity from 10 to 11, tripping the
`gocyclo -over 10` pre-commit hook (and leaving the PR UNSTABLE on
three retries).
Hoist the credential-failure save into a tiny `persistFailedAccountExecution`
helper so executeForAccount drops back to 10 while the audit-loss surfacing
behaviour and the new regression test
(TestExecuteForAccount_CredentialFailure_SaveErrorSurfaced) remain
identical: the helper still does `errors.Join(AUDIT LOSS..., cause)` on
save-failure and returns `cause` unchanged on success, so neither the
credential error nor the save error can be silently dropped.
- gocyclo -over 10 internal/purchase/execution.go: clean (executeForAccount=10).
- go vet ./internal/purchase/...: clean.
- go test ./internal/purchase/... -count=1: 207 passed.1 parent 4b68325 commit f0eccb8
1 file changed
Lines changed: 21 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
243 | 238 | | |
244 | 239 | | |
245 | 240 | | |
| |||
297 | 292 | | |
298 | 293 | | |
299 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
300 | 311 | | |
301 | 312 | | |
302 | 313 | | |
| |||
0 commit comments