Repository navigation
lint(errcheck): reasons for the nine bare suppressions - #367
Merged
Merged
Conversation
Nine //nolint:errcheck directives carried no reason at all, against 32 sites already using the repository's convention: the directive on its own line above the statement, reading "diagnose-ignored-error: <reason>; see docs/architecture/2.8-eventing-infrastructure.md". These nine now match it. Six are console writes (internal/console/console.go) and one an audit-log write (internal/pwsh/pwsh.go) — terminal and file output with no recovery path. In cmd/lore/lore/commands.go the Scanln at the low-confidence confirmation prompt cites the behavior that makes the discard safe: a failed read leaves response empty, which the following EqualFold treats as "not y" and cancels. The MarkFlagRequired cites that "from" is registered immediately above, which is the only condition under which it can fail. Bare nolint directives in the tree: 18 -> 9. The nine that remain are all gocognit/gocyclo, and they are stage 1b's scope, where ruling 4 decomposes and deletes them rather than annotating them. Verified: make vet, make build, and the full make test suite green — zero FAIL or panic lines, counted rather than read off a truncated tail. gofmt clean over the change set. Plan: docs/plans/audit-remediation.md (phase 1a). Issue: #365
David-Noble-at-work
added a commit
that referenced
this pull request
Aug 11, 2026
…verdicts (#370) Reviewing cmd/lore and cmd/writ for the issue #365 phase 1b decomposition surfaced two correctness defects. Both are recorded as their own issues and plans rather than folded into behavior-preserving refactoring work, where a semantic change would hide inside an extract-method diff. Issue #368 — lore deploy silently skips a manifest it cannot load. parseLoreDeployConfig logs the failure and continues, so the error return is dead and the //nolint:unparam on it documents a consequence as an intention. "lore deploy @typo.yaml some-package" deploys some-package and exits 0, having fulfilled half the request; "lore deploy @typo.yaml" reports "no packages to deploy", which is the wrong cause. Parsing precedes all deployment, so aborting costs nothing already done. Issue #369 — writ segment matching ignores its own suffix grammar. The grammar is [<project>|common][.<os>][.<distro>][.<arch>][.<custom>...] and segment.go:18 states it, but ParseDirName discards position and Match tests each suffix against one flat set of every dimension's values. So order is never validated (common.arm64.Darwin is accepted), position never selects a dimension, and specificity is a suffix count that cannot rank DISTRO above OS. common.Unix and common.Darwin both measure 1 on a Mac and tie; the tie is then resolved by sort.Slice, which is unstable, so the winner is undefined by contract. The phase 1b verdicts are recorded with measured gocyclo and gocognit for all nine targets. Ruling 5 is added: treatment is decided per function by whether it reads as steps. That produced five treatments rather than one — six extract, one flattens, one keeps an argued suppression, and applyGraphModifications needs no work at all (gocyclo 7, gocognit 8, under both thresholds; its directive suppresses nothing). buildMultiSource is deferred to #369. Its collision predicate at builder.go:280 has zero coverage, confirmed by make cover, and is reachable only through a tie whose winner is undefined. A behavior-preserving refactor of a predicate with no defined behavior is not possible. Phase 1a is marked completed — PR #367, bare nolint directives 18 to 9. Documentation only; no code changes. Issues: #365, #368, #369 Co-authored-by: David Noble <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 1a of the audit remediation plan (issue #365).
Nine
//nolint:errcheckdirectives carried no reason. The repository already has a convention for this — 32 sites use it — placing the directive on its own line above the statement://nolint:errcheck // diagnose-ignored-error: <reason>; see docs/architecture/2.8-eventing-infrastructure.mdThese nine now match it, rather than inventing new wording.
internal/console/console.go×6internal/pwsh/pwsh.gocmd/lore/lore/commands.go(Scanln)responseempty, which cancelscmd/lore/lore/commands.go(MarkFlagRequired)"from"is registered immediately aboveThe two
cmd/lorereasons cite the specific behavior that makes each discard safe, rather than asserting it is safe. ForScanln, a short read leavesresponseempty and the followingEqualFoldtreats that as "not y" — the prompt cancels, which is the correct outcome.Bare
nolintdirectives: 18 → 9. The nine remaining are allgocognit/gocycloand belong to stage 1b, where ruling 4 decomposes them under the #312 discipline and deletes the suppressions rather than annotating them.Verified:
make vet,make build, and the fullmake testsuite green — zeroFAILorpaniclines, counted rather than read off a truncated tail.gofmtclean over the change set. Comment-only; no behavior change.