ci: add Lefthook pre-commit hooks for auto-formatting#25
Merged
Conversation
Adds Lefthook to automatically format and lint staged files on commit: - Python: Black (format) + Flake8 (lint) on .py files - JavaScript: Biome (format) on frontend/ .js files - Optional conventional commit validation (commented out) Setup: run `npm install` — the prepare script installs hooks automatically. Contributors without Node.js can skip this; CI still catches formatting issues via the existing scripts.
Owner
|
Nice one. Thanks for this. |
OrbFrontend
added a commit
to hpnyaggerman/Orb
that referenced
this pull request
May 16, 2026
ci: add Lefthook pre-commit hooks for auto-formatting
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
CI catches formatting/lint issues, but contributors only find out after pushing. This adds local pre-commit hooks so formatting is auto-fixed before the commit even happens.
What
Adds Lefthook — a fast, language-agnostic git hooks manager. Config in one file (
lefthook.yml), installs automatically vianpm install.Pre-commit hooks
.py).py)Hooks run in parallel and only on staged files that match — fast.
Setup
That's it. The
preparescript inpackage.jsonrunslefthook installautomatically.No Node.js?
This is fully optional. Contributors without Node.js skip
npm installand run the existingscripts/format_backend.sh/scripts/format_frontend.shmanually. CI still catches everything.Changes
package.jsonpreparescriptlefthook.yml.gitignorenode_modules/,package-lock.jsonCONTRIBUTING.mdBonus
There's a commented-out conventional commit validator in
lefthook.yml. Uncomment it to enforcetype(scope): messageformat on commit messages.