Repository navigation
Check formatting before the commit, not after the push - #15
Merged
Merged
Conversation
Formatting has landed on main and turned the lint job red three times now (twice around #5, again in #14). The pattern never changes: rustfmt is enforced in CI and run nowhere else, so it is found after landing, by whoever pushes next. `make hooks` points core.hooksPath at .githooks/, so the hooks are versioned and change with the repo rather than being copied into .git once and forgotten. The hook checks formatting and nothing else. `make lint` runs clippy, golangci-lint and credo across nine services; a hook people wait thirty seconds for is a hook people pass --no-verify to, and then it protects nothing. Each language is checked only when a file of that language is staged, because the two slow starts are the BEAM and cargo and neither should be paid for a change that did not touch them. `make fmt` is the other half: whatever the hook rejects, it fixes. Two deliberate omissions: - No `buf format`. It reflows .proto comments onto a single space before the slashes, which destroys the column alignment several of those files use to keep a field's meaning readable next to its number. That is the author's style choice and a hook is the wrong place to overrule it — `make proto-lint` already covers the checks that catch real mistakes. - No `mix format` for a service without a .formatter.exs, since broadcast is still an empty shell (ADR 0010). Also fixes what gofmt immediately found: a stray blank line in driver.go, from #10. golangci-lint does not have gofmt enabled here, so CI never saw it.
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.
Formatting has landed on
mainand turned the lint job red three times — twice around #5 (on code from #3 and #4), and again yesterday in #14. The pattern never changes: rustfmt is enforced in CI and run nowhere else, so it is found after landing, by whoever pushes next.What this adds
.githooks/pre-commit— formatting check on staged filesmake hooks— pointscore.hooksPathat.githooks/, so hooks are versioned and change with the repo instead of being copied into.gitonce and forgottenmake fmt— the other half: whatever the hook rejects, this fixesThe design constraint
It checks formatting and nothing else.
make lintruns clippy, golangci-lint and credo across nine services. A hook people wait thirty seconds for is a hook people pass--no-verifyto, and then it protects nothing.Each language is checked only when a file of that language is staged — the two slow starts here are the BEAM and cargo, and neither should be paid for a change that did not touch them. Go is checked per file (gofmt needs no project context); Rust and Elixir per project, because rustfmt run per file needs the edition passed by hand and getting that wrong silently formats to the wrong rules.
The failure output names the check and both ways out:
Two deliberate omissions
No
buf format. I tried it and backed it out: it reflows.protocomments onto a single space before the slashes, destroying the column alignment those files use deliberately —That is a style choice by whoever wrote those files, and a hook is the wrong place to overrule it.
make proto-lintalready runsbuf lintandbuf breaking, which catch the mistakes that actually matter.No
mix formatfor a service without a.formatter.exs—broadcastis still an empty shell (ADR 0010), andmix formaterrors out rather than no-opping there.Found while testing it
gofmt immediately flagged a stray blank line in
driver.go, from my own #10.golangci-lintdoes not have gofmt enabled in this repo, so CI never saw it. Fixed here.Test plan
make hooks; a deliberately malformed.gofile is rejected with the message abovemake fmtthen makes the same commit passmake fmtis idempotent on a clean tree — running it twice changes nothingmake helplists both new targetsWhat this does not solve
Nothing in CI builds the Docker images, which is how the
go.workdrift in #11 went unnoticed until I built them by hand. Different problem, same shape — worth its own decision.🤖 Generated with Claude Code