Repository navigation
Make the git hooks fast: no analysis on commit, only what a push affects - #38
Merged
Merged
Conversation
pre-commit no longer analyzes. `dart analyze --fatal-infos` takes 40-55 s here even for one file, mostly loading the analyzer plugins, which is a commit you learn to skip with --no-verify. The IDE shows the same findings as you type, and pre-push analyzes before anything leaves the machine. Templates are synced into pubspec.yaml only when a template changed, instead of a `dart run` on every commit (~45 s whenever the native hooks were stale). pre-push checks only what the pushed commits can affect, compared with the remote ref or, for a new branch, where it left main: - docs and workflows alone run nothing; - the app is analyzed and tested when its code, tests, packages, assets, tools, dependencies or lint setup changed; - the packages are checked only when packages/ changed, since they cannot import the app (an app-only push: ~155 s to ~95 s); - no usable base checks everything. The checks still run one at a time: measured on an 8-core Mac, running them side by side was slower, as each already uses every core. CONTRIBUTING.md and setup_hooks.sh describe the new behaviour. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2 tasks done
burhankhanzada
added a commit
that referenced
this pull request
Oct 4, 2026
## What and why Follow-up to #38. `dart fix --apply` was most of what was left of a commit: it analyzes the whole project (~9 s, the same for one staged file as for all of them) to apply a handful of automated fixes, and it rewrote files that were not staged. The lints it fixes still show in the IDE and block at pre-push, and `dart fix --apply` is one command to run when they come up. A commit of staged Dart is now import sorting and formatting — about a second. ## How it was verified - [x] `sh -n` on the hook - [x] This branch's own commit and push went through the hooks: the commit (no Dart staged) took 0 s, and the push — only `.githooks/` and `setup_hooks.sh` changed — skipped its checks in 2 s, which is #38 doing what it says 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
pre-commit no longer analyzes:
dart analyze --fatal-infostakes 40–55 s here even for one file, which gets a hook skipped with--no-verify. The IDE shows the same findings, and pre-push analyzes before anything leaves the machine. Templates are synced intopubspec.yamlonly when a template changed (was adart runon every commit, ~45 s when native hooks were stale).pre-push checks only what the pushed commits can affect, compared with the remote ref (or, for a new branch, where it left
main):packages/: the package checks too (packages can't import the app; an app-only push went ~155 s → ~95 s);Checks still run one at a time: side by side was slower on an 8-core Mac.
Tested locally: a synthetic docs-only commit skips in under a second (pushed both as an existing and as a new branch); a code commit (#28's) runs the full analysis and tests; both hooks pass
sh -n. Pushing this branch itself skipped, as it should.CONTRIBUTING.mdandsetup_hooks.shdescribe the new behaviour.🤖 Generated with Claude Code