chore(make): add pre-commit + install-hooks targets#8
Merged
Conversation
Mirrors the kalshi-cpp Makefile pattern. Eliminates the recurring "push -> CI clang-format/cpp_auto_audit fail -> follow-up fix PR" loop by making the lint+format check trivially runnable before every commit. - `make pre-commit` runs `format` then `lint` - `make install-hooks` drops .git/hooks/pre-commit that fires `make pre-commit` on every `git commit`. Idempotent. Pre-commit hook is opt-in (one-shot operator setup) and CI gates are unchanged — this is pure local DX.
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.
Summary
Adds two new Make targets to mirror the kalshi-cpp pattern (PR kalshi-trader#30 + PR kalshi-cpp#20):
make pre-commitrunsformatthenlintin one shot.make install-hooksdrops a.git/hooks/pre-commitshim that firesmake pre-commitautomatically ongit commit. Idempotent — re-running prints "already installed".Why: every C++ SDK in this fleet has hit the same recurring CI break (a developer pushes, CI fails on clang-format / cpp_auto_audit, a follow-up PR is opened to fix). The pre-commit hook makes that class of break catchable locally before the push.
Pre-commit is opt-in (one-shot operator setup) and CI gates are unchanged — this is purely local DX.
Test plan
make pre-commiton a clean tree → format no-op + lint passesmake install-hookswrites.git/hooks/pre-commitand is executablemake install-hooksprints "pre-commit hook already installed" and exits 0