Conversation
`prek uninstall` previously only removed the default hook types unless `-t` was specified, which could leave other prek-managed hooks behind. Add an explicit `--all` flag to remove every prek-managed hook from `.git/hooks`, while keeping the default behavior limited to configured hook types or `pre-commit`. Also suppress skip messages during `--all` scans and add tests for removing multiple hooks and for the no-op case.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1817 +/- ##
=======================================
Coverage 91.72% 91.72%
=======================================
Files 98 98
Lines 20055 20063 +8
=======================================
+ Hits 18395 18403 +8
Misses 1660 1660 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds an --all flag to the prek uninstall subcommand so users can remove every prek-managed Git hook shim in one go, addressing the longstanding UX gap where uninstall could leave other installed hook types behind.
Changes:
- Add
--alltoprek uninstall, mutually exclusive with-t/--hook-type. - Implement
--allbehavior by iterating all supportedHookTypevariants and removing those detected as prek-managed viais_our_script(). - Add integration tests/snapshots validating
--allremoves multiple hooks and no-ops cleanly when nothing is installed.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/prek/src/cli/mod.rs | Adds the --all flag to UninstallArgs and documents/conflicts it with --hook-type. |
| crates/prek/src/main.rs | Wires the new args.all flag through to the uninstall handler. |
| crates/prek/src/cli/install.rs | Implements the uninstall --all logic and suppresses skip messages when iterating all hook types. |
| crates/prek/tests/install.rs | Adds snapshot tests covering prek uninstall --all behavior. |
📦 Cargo Bloat ComparisonBinary size change: +0.00% (24.8 MiB → 24.8 MiB) Expand for cargo-bloat outputHead Branch ResultsBase Branch Results |
⚡️ Hyperfine BenchmarksSummary: 0 regressions, 0 improvements above the 10% threshold. Environment
CLI CommandsBenchmarking basic commands in the main repo:
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base --version |
1.8 ± 0.2 | 1.6 | 3.5 | 1.01 ± 0.14 |
prek-head --version |
1.8 ± 0.1 | 1.6 | 2.9 | 1.00 |
prek list
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base list |
7.5 ± 0.7 | 7.1 | 12.1 | 1.02 ± 0.09 |
prek-head list |
7.4 ± 0.2 | 7.1 | 8.6 | 1.00 |
prek validate-config .pre-commit-config.yaml
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base validate-config .pre-commit-config.yaml |
2.5 ± 0.1 | 2.3 | 2.9 | 1.00 ± 0.13 |
prek-head validate-config .pre-commit-config.yaml |
2.5 ± 0.3 | 2.3 | 4.4 | 1.00 |
prek sample-config
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base sample-config |
2.1 ± 0.0 | 1.9 | 2.2 | 1.01 ± 0.03 |
prek-head sample-config |
2.0 ± 0.0 | 1.9 | 2.2 | 1.00 |
Cold vs Warm Runs
Comparing first run (cold) vs subsequent runs (warm cache):
prek run --all-files (cold - no cache)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run --all-files |
99.3 ± 1.4 | 97.9 | 101.7 | 1.00 ± 0.02 |
prek-head run --all-files |
99.0 ± 1.1 | 97.6 | 101.5 | 1.00 |
prek run --all-files (warm - with cache)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run --all-files |
100.0 ± 1.3 | 98.3 | 102.6 | 1.00 |
prek-head run --all-files |
100.4 ± 2.1 | 97.4 | 105.0 | 1.00 ± 0.02 |
Full Hook Suite
Running the builtin hook suite on the benchmark workspace:
prek run --all-files (full builtin hook suite)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run --all-files |
100.6 ± 2.2 | 97.6 | 108.2 | 1.00 |
prek-head run --all-files |
100.6 ± 3.2 | 97.0 | 119.9 | 1.00 ± 0.04 |
Individual Hook Performance
Benchmarking each hook individually on the test repo:
prek run trailing-whitespace --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run trailing-whitespace --all-files |
14.8 ± 0.6 | 14.0 | 16.8 | 1.00 |
prek-head run trailing-whitespace --all-files |
15.1 ± 1.2 | 13.9 | 18.3 | 1.02 ± 0.09 |
prek run end-of-file-fixer --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run end-of-file-fixer --all-files |
18.8 ± 1.2 | 16.8 | 21.4 | 1.01 ± 0.09 |
prek-head run end-of-file-fixer --all-files |
18.6 ± 1.1 | 17.2 | 22.0 | 1.00 |
prek run check-json --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-json --all-files |
9.2 ± 0.4 | 8.7 | 10.7 | 1.03 ± 0.06 |
prek-head run check-json --all-files |
9.0 ± 0.3 | 8.3 | 10.2 | 1.00 |
prek run check-yaml --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-yaml --all-files |
8.7 ± 1.0 | 8.2 | 13.9 | 1.03 ± 0.12 |
prek-head run check-yaml --all-files |
8.4 ± 0.2 | 8.1 | 8.8 | 1.00 |
prek run check-toml --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-toml --all-files |
8.4 ± 0.2 | 8.1 | 8.8 | 1.02 ± 0.03 |
prek-head run check-toml --all-files |
8.3 ± 0.1 | 7.9 | 8.5 | 1.00 |
prek run check-xml --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-xml --all-files |
8.5 ± 0.3 | 8.1 | 9.2 | 1.02 ± 0.04 |
prek-head run check-xml --all-files |
8.3 ± 0.2 | 8.0 | 8.8 | 1.00 |
prek run detect-private-key --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run detect-private-key --all-files |
13.1 ± 0.8 | 11.6 | 15.8 | 1.00 |
prek-head run detect-private-key --all-files |
13.1 ± 0.7 | 11.8 | 14.8 | 1.01 ± 0.08 |
prek run fix-byte-order-marker --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run fix-byte-order-marker --all-files |
16.5 ± 1.8 | 14.4 | 24.0 | 1.00 |
prek-head run fix-byte-order-marker --all-files |
16.9 ± 0.9 | 15.5 | 18.4 | 1.02 ± 0.12 |
Installation Performance
Benchmarking hook installation (fast path hooks skip Python setup):
prek install-hooks (cold - no cache)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base install-hooks |
3.7 ± 0.1 | 3.6 | 3.9 | 1.00 ± 0.04 |
prek-head install-hooks |
3.7 ± 0.1 | 3.6 | 3.8 | 1.00 |
prek install-hooks (warm - with cache)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base install-hooks |
3.7 ± 0.1 | 3.5 | 3.8 | 1.00 |
prek-head install-hooks |
3.7 ± 0.1 | 3.7 | 3.8 | 1.01 ± 0.03 |
File Filtering/Scoping Performance
Testing different file selection modes:
prek run (staged files only)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run |
36.3 ± 1.1 | 34.8 | 39.3 | 1.00 |
prek-head run |
36.7 ± 1.2 | 35.3 | 40.4 | 1.01 ± 0.05 |
prek run --files '*.json' (specific file type)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run --files '*.json' |
6.3 ± 0.1 | 6.0 | 6.6 | 1.00 |
prek-head run --files '*.json' |
6.5 ± 0.3 | 6.2 | 7.8 | 1.03 ± 0.06 |
Workspace Discovery & Initialization
Benchmarking hook discovery and initialization overhead:
prek run --dry-run --all-files (measures init overhead)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run --dry-run --all-files |
9.6 ± 0.2 | 9.4 | 10.1 | 1.01 ± 0.03 |
prek-head run --dry-run --all-files |
9.5 ± 0.2 | 9.2 | 10.0 | 1.00 |
Meta Hooks Performance
Benchmarking meta hooks separately:
prek run check-hooks-apply --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-hooks-apply --all-files |
9.8 ± 0.1 | 9.6 | 10.1 | 1.01 ± 0.02 |
prek-head run check-hooks-apply --all-files |
9.7 ± 0.2 | 9.5 | 10.3 | 1.00 |
prek run check-useless-excludes --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-useless-excludes --all-files |
9.8 ± 0.3 | 9.5 | 10.3 | 1.02 ± 0.03 |
prek-head run check-useless-excludes --all-files |
9.7 ± 0.2 | 9.3 | 9.9 | 1.00 |
prek run identity --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run identity --all-files |
7.9 ± 0.3 | 7.5 | 8.4 | 1.04 ± 0.05 |
prek-head run identity --all-files |
7.6 ± 0.1 | 7.5 | 7.9 | 1.00 |
b86fb0f to
9e5a7f3
Compare
There was a problem hiding this comment.
Pull request overview
Adds an --all flag to the prek uninstall subcommand to remove all prek-managed Git hook shims (as detected by is_our_script()), while keeping existing uninstall behavior unchanged unless the flag is provided.
Changes:
- Add
--alltoprek uninstalland wire it through CLI parsing to uninstall logic. - When
--allis used, iterate over hook types and suppress “not managed” / “does not exist” skip messages. - Add integration tests covering
--alluninstall behavior with multiple hooks and with no hooks installed.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/cli.md | Documents the new --all option for prek uninstall. |
| crates/prek/tests/install.rs | Adds tests/snapshots for prek uninstall --all. |
| crates/prek/src/main.rs | Passes the parsed --all flag into the uninstall handler. |
| crates/prek/src/cli/mod.rs | Adds the --all flag to UninstallArgs with a conflicts_with rule. |
| crates/prek/src/cli/install.rs | Implements --all behavior by iterating hook types and suppressing certain skip messages. |
661cde5 to
5267a71
Compare
|
Thank you! |
There was a problem hiding this comment.
Pull request overview
Adds an --all option to prek uninstall to remove all prek-managed Git hook shims, making it easier to clean up across hook types.
Changes:
- Introduce
--allflag forprek uninstall(conflicts with--hook-type) and plumb it through the CLI. - Update uninstall behavior to iterate all supported hook types when
--allis set (and suppress “skipping” noise). - Add an integration test covering
prek uninstall --allbehavior and update CLI reference docs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/cli.md | Documents the new --all option in the generated CLI reference. |
| crates/prek/tests/install.rs | Adds an integration test verifying --all removes managed hooks while leaving non-managed hooks intact. |
| crates/prek/src/main.rs | Wires the new args.all flag into the uninstall command invocation. |
| crates/prek/src/cli/mod.rs | Adds --all flag to UninstallArgs and updates help text. |
| crates/prek/src/cli/install.rs | Implements --all behavior by uninstalling across all supported HookType variants and reducing skip output. |
Summary
Closes #1779
--allflag toprek uninstallthat scans the hooks directory and removes every prek-managed hook (detected viais_our_script()), regardless of hook type--all, behavior is unchanged: uses-tordefault_install_hook_types, falls back topre-commit--alland-tare mutually exclusive (conflicts_with)--allis used, since iterating all hook types will naturally hit many non-existent onesTests
uninstall_all_managed_hooks:--allremoves all prek-managed hooksuninstall_all_no_hooks:--allexits cleanly when no hooks are installedmise run lintand confirmed no errors