Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2044 +/- ##
==========================================
+ Coverage 92.26% 92.29% +0.02%
==========================================
Files 119 119
Lines 24266 24281 +15
==========================================
+ Hits 22389 22410 +21
+ Misses 1877 1871 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
📦 Cargo Bloat ComparisonBinary size change: +0.00% (26.1 MiB → 26.1 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 |
2.6 ± 0.1 | 2.4 | 3.2 | 1.02 ± 0.06 |
prek-head --version |
2.5 ± 0.1 | 2.4 | 2.7 | 1.00 |
prek list
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base list |
9.9 ± 0.2 | 9.6 | 10.5 | 1.00 |
prek-head list |
9.9 ± 0.2 | 9.5 | 10.4 | 1.00 ± 0.03 |
prek validate-config .pre-commit-config.yaml
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base validate-config .pre-commit-config.yaml |
3.5 ± 0.1 | 3.3 | 3.7 | 1.01 ± 0.04 |
prek-head validate-config .pre-commit-config.yaml |
3.5 ± 0.1 | 3.3 | 3.7 | 1.00 |
prek sample-config
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base sample-config |
2.8 ± 0.2 | 2.7 | 4.0 | 1.00 ± 0.08 |
prek-head sample-config |
2.8 ± 0.1 | 2.7 | 3.0 | 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 |
153.4 ± 2.4 | 149.4 | 157.0 | 1.01 ± 0.03 |
prek-head run --all-files |
152.1 ± 4.3 | 147.3 | 162.1 | 1.00 |
prek run --all-files (warm - with cache)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run --all-files |
151.6 ± 4.3 | 146.2 | 162.0 | 1.00 |
prek-head run --all-files |
151.9 ± 4.6 | 146.0 | 160.7 | 1.00 ± 0.04 |
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 |
155.5 ± 3.9 | 147.0 | 163.0 | 1.00 |
prek-head run --all-files |
155.7 ± 11.1 | 147.8 | 223.0 | 1.00 ± 0.08 |
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 |
22.0 ± 0.6 | 21.1 | 23.4 | 1.00 ± 0.03 |
prek-head run trailing-whitespace --all-files |
22.0 ± 0.5 | 21.3 | 23.2 | 1.00 |
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 |
29.0 ± 2.1 | 25.8 | 33.1 | 1.00 |
prek-head run end-of-file-fixer --all-files |
29.9 ± 4.5 | 24.7 | 46.7 | 1.03 ± 0.17 |
prek run check-json --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-json --all-files |
13.5 ± 0.2 | 13.2 | 14.0 | 1.02 ± 0.04 |
prek-head run check-json --all-files |
13.2 ± 0.5 | 12.2 | 13.9 | 1.00 |
prek run check-yaml --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-yaml --all-files |
12.6 ± 0.5 | 12.1 | 13.7 | 1.01 ± 0.04 |
prek-head run check-yaml --all-files |
12.4 ± 0.2 | 12.1 | 12.8 | 1.00 |
prek run check-toml --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-toml --all-files |
12.8 ± 0.3 | 12.2 | 13.4 | 1.00 |
prek-head run check-toml --all-files |
12.9 ± 0.3 | 12.4 | 13.6 | 1.01 ± 0.03 |
prek run check-xml --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-xml --all-files |
13.0 ± 0.6 | 12.1 | 15.8 | 1.01 ± 0.06 |
prek-head run check-xml --all-files |
12.9 ± 0.4 | 12.2 | 13.6 | 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 |
19.6 ± 1.4 | 17.4 | 23.8 | 1.01 ± 0.10 |
prek-head run detect-private-key --all-files |
19.4 ± 1.4 | 16.6 | 22.4 | 1.00 |
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 |
24.2 ± 1.8 | 20.6 | 26.8 | 1.02 ± 0.10 |
prek-head run fix-byte-order-marker --all-files |
23.8 ± 1.4 | 21.4 | 26.8 | 1.00 |
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 |
5.4 ± 0.1 | 5.3 | 5.5 | 1.00 ± 0.03 |
prek-head install-hooks |
5.4 ± 0.1 | 5.2 | 5.6 | 1.00 |
prek install-hooks (warm - with cache)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base install-hooks |
5.3 ± 0.1 | 5.3 | 5.5 | 1.01 ± 0.02 |
prek-head install-hooks |
5.3 ± 0.1 | 5.3 | 5.4 | 1.00 |
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 |
52.8 ± 1.5 | 50.7 | 57.2 | 1.00 ± 0.04 |
prek-head run |
52.7 ± 1.3 | 50.1 | 55.3 | 1.00 |
prek run --files '*.json' (specific file type)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run --files '*.json' |
9.2 ± 0.1 | 8.9 | 9.4 | 1.00 |
prek-head run --files '*.json' |
9.3 ± 0.1 | 9.0 | 9.6 | 1.01 ± 0.02 |
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 |
17.4 ± 0.3 | 16.9 | 18.3 | 1.01 ± 0.02 |
prek-head run --dry-run --all-files |
17.1 ± 0.2 | 16.7 | 17.7 | 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 |
14.7 ± 0.2 | 14.4 | 15.0 | 1.13 ± 0.02 |
prek-head run check-hooks-apply --all-files |
13.0 ± 0.1 | 12.8 | 13.2 | 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 |
13.3 ± 0.4 | 13.0 | 14.7 | 1.01 ± 0.03 |
prek-head run check-useless-excludes --all-files |
13.3 ± 0.1 | 13.0 | 13.4 | 1.00 |
prek run identity --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run identity --all-files |
11.4 ± 0.1 | 11.3 | 11.6 | 1.00 |
prek-head run identity --all-files |
11.6 ± 0.2 | 11.3 | 12.3 | 1.02 ± 0.02 |
dec2146 to
5b7e65f
Compare
There was a problem hiding this comment.
Pull request overview
Adds a project-level auto_update.cooldown_days configuration so prek auto-update can default its cooldown window from the project config (YAML/TOML), with CLI override still taking precedence, and global config as fallback. This fits into prek’s configuration model by extending Config and routing cooldown resolution through workspace/project discovery so each project can be evaluated with its own cooldown.
Changes:
- Extend project config model + JSON schema with
auto_update.cooldown_days. - Resolve cooldown per project (CLI → project → global → default) and thread it through auto-update’s repo-target evaluation.
- Update docs and integration tests/snapshots to cover workspace/project cooldown behavior.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
prek.schema.json |
Adds auto_update to the project config schema and defines AutoUpdateOptions.cooldown_days. |
docs/reference/configuration.md |
Documents global vs project auto_update.cooldown_days and precedence rules. |
docs/reference/cli.md |
Updates --cooldown-days help text to mention project config precedence. |
docs/configuration.md |
Adds project config examples for auto_update.cooldown_days and lists it as a prek-only YAML extension. |
crates/prek/tests/global_config.rs |
Adjusts global-config tests to run auto-update with a minimal project config present (and updates snapshots accordingly). |
crates/prek/tests/auto_update.rs |
Adds a workspace test asserting per-project cooldown behavior when sharing the same repo URL. |
crates/prek/src/snapshots/prek__config__tests__read_yaml_config.snap |
Updates config parsing snapshot to include the new auto_update field (default None). |
crates/prek/src/snapshots/prek__config__tests__read_toml_config.snap |
Updates config parsing snapshot to include the new auto_update field (default None). |
crates/prek/src/snapshots/prek__config__tests__read_config_with_nested_merge_keys.snap |
Updates snapshot for new Config field. |
crates/prek/src/snapshots/prek__config__tests__read_config_with_merge_keys.snap |
Updates snapshot for new Config field. |
crates/prek/src/snapshots/prek__config__tests__parse_repos.snap |
Updates snapshot for new Config field. |
crates/prek/src/snapshots/prek__config__tests__parse_repos-6.snap |
Updates snapshot for new Config field. |
crates/prek/src/snapshots/prek__config__tests__parse_repos-4.snap |
Updates snapshot for new Config field. |
crates/prek/src/snapshots/prek__config__tests__parse_repos-3.snap |
Updates snapshot for new Config field. |
crates/prek/src/snapshots/prek__config__tests__parse_hooks-3.snap |
Updates snapshot for new Config field. |
crates/prek/src/snapshots/prek__config__tests__numeric_rev_is_parsed_as_string.snap |
Updates snapshot for new Config field. |
crates/prek/src/snapshots/prek__config__tests__meta_hooks-5.snap |
Updates snapshot for new Config field. |
crates/prek/src/snapshots/prek__config__tests__language_version.snap |
Updates snapshot for new Config field. |
crates/prek/src/settings.rs |
Updates cooldown resolution logic to incorporate project-level cooldown (between CLI and global). |
crates/prek/src/main.rs |
Passes cooldown + filesystem options into auto_update for per-project resolution; changes --show-settings behavior for this command. |
crates/prek/src/hook.rs |
Updates an internal test Config literal to include the new auto_update field. |
crates/prek/src/config.rs |
Introduces AutoUpdateOptions and adds Config.auto_update field (project-level). |
crates/prek/src/cli/mod.rs |
Updates --cooldown-days docs to mention project config fallback. |
crates/prek/src/cli/auto_update/source.rs |
Resolves cooldown per project and includes it in repo-target grouping + evaluation. |
crates/prek/src/cli/auto_update/mod.rs |
Plumbs CLI cooldown + global filesystem options into repo source collection; drops global cooldown param from per-repo evaluation path. |
Comments suppressed due to low confidence (1)
docs/reference/configuration.md:20
- The docs describe
auto_update.cooldown_daysas an unconstrained “integer days”, but the implementation usesu8(and the JSON schema enforces0..=255). Document the valid range (or at least note the 255-day maximum) so users aren’t surprised by parse/CLI validation failures for larger values.
Default cooldown for `prek auto-update`.
- Type: integer days
- Default: `0`
- CLI override: `prek auto-update --cooldown-days <DAYS>`
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 525a0c428a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let filesystem = FilesystemOptions::user()?; | ||
| let settings = AutoUpdateSettings::resolve(&args, filesystem.as_ref()); | ||
| show_settings!(settings); | ||
| show_settings!(args); |
There was a problem hiding this comment.
Preserve resolved settings in auto-update debug output
--show-settings is documented as showing resolved settings, but this branch now calls show_settings!(args) before running auto_update, so it prints only raw AutoUpdateArgs and exits without ever resolving project/global auto_update.cooldown_days precedence. In practice, prek auto-update --show-settings can no longer reveal the effective cooldown when it comes from config files, which is a regression for debugging configuration behavior.
Useful? React with 👍 / 👎.
| @@ -394,7 +393,8 @@ async fn run(cli: Cli) -> Result<ExitStatus> { | |||
| args.jobs, | |||
| args.dry_run || args.check, | |||
| args.exit_code || args.check, | |||
| settings.cooldown_days, | |||
| args.cooldown_days, | |||
| filesystem, | |||
| printer, | |||
| ) | |||
| pub(crate) fn resolve( | ||
| cli_cooldown_days: Option<u8>, | ||
| filesystem: Option<&FilesystemOptions>, | ||
| project_cooldown_days: Option<u8>, | ||
| ) -> Self { | ||
| Self { | ||
| cooldown_days: args | ||
| .cooldown_days | ||
| cooldown_days: cli_cooldown_days | ||
| .or(project_cooldown_days) | ||
| .or_else(|| { | ||
| filesystem | ||
| .and_then(|fs| fs.auto_update.as_ref()) | ||
| .and_then(|au| au.cooldown_days) | ||
| .and_then(|options| options.cooldown_days) | ||
| }) | ||
| .unwrap_or_default(), | ||
| } |
Summary
Add project-level
auto_update.cooldown_dayssupport forprek.tomland.pre-commit-config.yaml.Closes #1765