Skip to content

Errors from git and the file system say what was being done - #83

Merged
closer-claudio merged 1 commit into
mainfrom
claudio/20261115-lint-wrapcheck
Nov 15, 2026
Merged

closer-claudio merged 1 commit into
mainfrom
claudio/20261115-lint-wrapcheck

Conversation

@closer-claudio

Copy link
Copy Markdown

🎯 Why

wrapcheck was switched off for git/commits.go and validate/runner.go as part of the onboarding lint backlog. It finds nine errors returned exactly as another package gave them, so a failure said "exit status 128" or "no such file or directory" with nothing about what was being done.

For #37, the backlog, worked off one linter per pull request. This is the first.

🛠️ What

  • .lint-go.yaml: wrapcheck leaves the backlog block for the two files; their counts are lowered.
  • git/commits.go, validate/runner.go: the nine errors are wrapped with what was being done ("listing the commits of ", "entering ", "git show ").
  • rules/danglingwhitespace/rule.go: the rule told git's "whitespace errors" exit from a failure by the error's text (err.Error() == "exit status 2"), which a wrapped error no longer equals. It now reads the exit status from the error with errors.As.
  • cmd/git-validation/contract_test.go: TestContractWhitespaceErrorsAreNamed holds the rule's message, which no test did.

🧪 How

  1. lint: wrapcheck leaves the backlog, its nine errors wrapped
    • V: just lint and just test pass on macOS arm64 (57 tests, unit and race).
    • V: the new contract test passes, and fails with the rule as it was once git.Check's error is wrapped.
    • U: Linux and Windows, left to CI.

📝 Notes

  • An error's text changes for a consumer that prints it; errors.Is and errors.As see the same errors as before.

wrapcheck was off for git/commits.go and validate/runner.go as part of
the onboarding backlog. It finds nine errors returned as another
package gave them: git's exit status from `git version`,
`git log --check` and `git show`, and the working directory, the chdir
and the commit lookups of the runner. Each now says what was being
done: "listing the commits of <range>", "entering <dir>", "git show
<commit>".

Wrapping `git.Check`'s error would have broken the dangling-whitespace
rule, which told git's "whitespace errors" exit from a failure by the
error's text (`err.Error() == "exit status 2"`). The rule now reads the
exit status from the error (`errors.As` to `*exec.ExitError`), which
the wrap keeps. No test held the rule's message: the command's contract
test now does, and it fails on the rule as it was once the error is
wrapped.

The backlog's counts for the two files are lowered by what left it.

For #37.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: closer-claudio <claudio@farcloser.world>
@closer-claudio

Copy link
Copy Markdown
Author

Reviewed at 2999bba

@closer-claudio
closer-claudio merged commit 95036e4 into main Nov 15, 2026
14 checks passed
@closer-claudio
closer-claudio deleted the claudio/20261115-lint-wrapcheck branch November 15, 2026 18:10
closer-claudio added a commit that referenced this pull request Nov 16, 2026
The table of what upstream does not have stops at the shallow-clone
refusal. Three later changes a user of the command can see have no
row: QUIET in the environment no longer quiets it
(#81), errors say
what was being done
(#83), and a run can
be stopped (#86).

Upstream's main is still the commit forked from: the comparison of
a8d4555 with main, asked of GitHub today, is zero commits ahead. The
"Reviewed through" line takes today's date.

For #50.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: closer-claudio <claudio@farcloser.world>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants