Add a canonical pre-commit clang-format config for the Tap family#2
Merged
Conversation
Formatting failures that CI catches should never leave a developer's machine. Adds .pre-commit-config.yaml as a fourth canonical TapHouse file: it pins the official pre-commit/mirrors-clang-format hook at v18.1.3 (the Tap-wide clang-format version, matching CI), scoped to C/C++ and excluding third_party. Distributed like the other configs — sync.sh copies it in, drift-check.yml guards it — so every Tap repo runs the same hook at the same pinned version. Consumer CI should run `pre-commit run --all-files` instead of a separately-installed clang-format, making local and CI share one version by construction (verified: mirror v18.1.3 == ubuntu apt clang-format-18 on the MuTap tree, byte-for-byte). We reference the upstream mirror rather than republishing clang-format as a TapHouse Python package: both pull the same pinned wheel from PyPI, so the mirror is the same guarantee with less machinery, and the pin still lives here. clang-tidy stays a CI concern (it needs a compile DB and per-TU vendored exclusion) — the hook is the fast, layout-only layer. - .pre-commit-config.yaml: canonical consumer config (pins the mirror rev) - scripts/sync.sh, .github/workflows/drift-check.yml: add it to the synced set - README.md: adoption steps, the CI-runs-pre-commit note, the two version knobs Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TLE2rvptWxV8catE8vTvgx
This was referenced Jul 19, 2026
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.
Why
A clang-format CI failure should never leave a developer's machine — but there was no shared way to run the format check locally before pushing. This adds pre-commit to TapHouse so every Tap repo catches formatting at
git commit, at the same pinned clang-format version as CI.What
A fourth canonical file,
.pre-commit-config.yaml, distributed and guarded exactly like the others:.pre-commit-config.yaml(new) — pins the officialpre-commit/mirrors-clang-formathook atv18.1.3(the Tap-wide clang-format version, matching CI), scopedtypes_or: [c, c++]andexclude: '^third_party/'.scripts/sync.sh— copies it into consumers alongside.clang-format/.clang-tidy/STYLE.md..github/workflows/drift-check.yml— diffs it too, so a consumer's copy can't silently diverge.README.md— adoption steps (pre-commit install), the "run the same hook in CI viapre-commit run" note, and the two version knobs (the TapHouse tag vs the mirror rev).Design notes
revis the clang-format version for the whole family, set once here and carried to every repo bysync.sh. Consumer CI runspre-commit run --all-filesinstead of a separately-installed clang-format, so local and CI share one version by construction — the exact skew that makes an ad-hoc hook worse than none.repo: tap/taphouse) would require making TapHouse a pip-installable package — which just reimplementsmirrors-clang-formatand pulls clang-format from the same PyPI wheel anyway. Referencing the upstream mirror is the same guarantee with less machinery; the pin still lives here, in the synced config.Validation
Ran the config against the MuTap tree: the mirror's clang-format v18.1.3 produces byte-identical output to ubuntu's apt
clang-format-18on every CI-checked file (zero diff) — confirming no local/CI skew. The only files it additionally flags are ones MuTap's CI list doesn't currently cover (a coverage gap the broader hook would close on adoption).Bump this repo to
v3on merge so consumers can pinref: v3.Rollout (follow-up, per consumer)
sync.shthe new config into mutap / mutap-max / sampleratetap,pre-commit install, switch each repo's clang-format CI job topre-commit run --all-files, and bump the driftref:tov3.🤖 Generated with Claude Code
https://claude.ai/code/session_01TLE2rvptWxV8catE8vTvgx
Generated by Claude Code