Skip to content

Conversation

@hofbi
Copy link

@hofbi hofbi commented Jan 29, 2026

Currently if the minimum prek version does not match, a user sees something like

Required minimum prek version `0.3.0` is greater than current version `0.2.30`. Please consider updating prek.

It would be nice to give the user a more concrete action to fix this error. To do so, I am adding an optional filed to the config named prek_upgrade_suggestion. This allows specifying an extra message like Please run 'uv tool install prek' or Please run prek self upgrade which is shown on top of the error message above.

@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

❌ Patch coverage is 88.70968% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.41%. Comparing base (7640685) to head (5564756).

Files with missing lines Patch % Lines
crates/prek/src/config.rs 88.52% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1490      +/-   ##
==========================================
- Coverage   91.51%   91.41%   -0.10%     
==========================================
  Files          87       87              
  Lines       18153    18210      +57     
==========================================
+ Hits        16612    16647      +35     
- Misses       1541     1563      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@prek-ci-bot
Copy link

prek-ci-bot bot commented Jan 29, 2026

📦 Cargo Bloat Comparison

Binary size change: +0.00% (22.5 MiB → 22.5 MiB)

Expand for cargo-bloat output

Head Branch Results

 File  .text    Size           Crate Name
 0.3%   0.8% 75.6KiB           prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.3%   0.6% 59.7KiB            prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.2%   0.6% 56.3KiB            prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.2%   0.5% 43.4KiB            prek prek::identify::by_extension::{{closure}}
 0.2%   0.5% 43.3KiB            prek prek::run::{{closure}}
 0.2%   0.4% 41.7KiB            prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4% 40.9KiB            prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.1%   0.3% 31.7KiB           prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.2% 22.2KiB            prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 21.0KiB    clap_builder clap_builder::parser::parser::Parser::get_matches_with
 0.1%   0.2% 20.8KiB            prek prek::archive::unzip::{{closure}}
 0.1%   0.2% 20.2KiB            prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 20.0KiB cargo_metadata? <cargo_metadata::_::<impl serde_core::de::Deserialize for cargo_metadata::Package>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2% 19.5KiB            prek <prek::languages::ruby::ruby::Ruby as prek::languages::LanguageImpl>::install::{{closure}}
 0.1%   0.2% 19.5KiB            prek prek::cli::run::filter::collect_files_from_args::{{closure}}
 0.1%   0.2% 19.1KiB            prek prek::cli::run::filter::collect_files_from_args::{{closure}}
 0.1%   0.2% 18.6KiB            ring ring_core_0_17_14__x25519_ge_frombytes_vartime
 0.1%   0.2% 18.4KiB            prek prek::hook::HookBuilder::build::{{closure}}
 0.1%   0.2% 18.4KiB            prek prek::hook::HookBuilder::build::{{closure}}
 0.1%   0.2% 18.4KiB            prek prek::hook::HookBuilder::build::{{closure}}
36.8%  91.6%  8.3MiB                 And 20041 smaller methods. Use -n N to show more.
40.2% 100.0%  9.1MiB                 .text section size, the file size is 22.5MiB

Base Branch Results

 File  .text    Size           Crate Name
 0.3%   0.8% 71.7KiB           prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.3%   0.6% 59.5KiB            prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.2%   0.6% 56.1KiB            prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.2%   0.5% 43.4KiB            prek prek::identify::by_extension::{{closure}}
 0.2%   0.5% 43.3KiB            prek prek::run::{{closure}}
 0.2%   0.4% 41.5KiB            prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4% 40.8KiB            prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.1%   0.3% 31.8KiB           prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.2% 21.6KiB            prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 21.0KiB    clap_builder clap_builder::parser::parser::Parser::get_matches_with
 0.1%   0.2% 20.8KiB            prek prek::archive::unzip::{{closure}}
 0.1%   0.2% 20.0KiB cargo_metadata? <cargo_metadata::_::<impl serde_core::de::Deserialize for cargo_metadata::Package>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2% 19.4KiB            prek prek::cli::run::filter::collect_files_from_args::{{closure}}
 0.1%   0.2% 19.4KiB            prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 19.4KiB            prek prek::cli::run::filter::collect_files_from_args::{{closure}}
 0.1%   0.2% 19.3KiB            prek <prek::languages::ruby::ruby::Ruby as prek::languages::LanguageImpl>::install::{{closure}}
 0.1%   0.2% 18.6KiB            ring ring_core_0_17_14__x25519_ge_frombytes_vartime
 0.1%   0.2% 18.5KiB            prek prek::hook::HookBuilder::build::{{closure}}
 0.1%   0.2% 18.5KiB            prek prek::hook::HookBuilder::build::{{closure}}
 0.1%   0.2% 18.5KiB            prek prek::hook::HookBuilder::build::{{closure}}
36.9%  91.6%  8.3MiB                 And 20033 smaller methods. Use -n N to show more.
40.2% 100.0%  9.1MiB                 .text section size, the file size is 22.5MiB

@j178
Copy link
Owner

j178 commented Jan 30, 2026

Thanks for working on this. We’re pretty careful about adding new options, and I don’t think prek_upgrade_suggestion on its own is enough reason to create another one. Plus, I don’t think this suggestion really works, since the config writer doesn’t actually know how prek is installed on the user’s side.

@hofbi
Copy link
Author

hofbi commented Jan 30, 2026

Makes sense that you don't want to bloat prek with new options here.

Maybe to clarify the motivation a bit. When using prek on a large project, you typically have a well defined and automated way to setup a developers's environment. With that, we exactly know how developers have installed prek, so being able to give them a concrete command to run would be very useful.

Now if we think about "the config writer doesn’t actually know how prek is installed on the user’s side", would it be possible to get to know this? Because if we would know this somehow, we would not need the prek_upgrade_suggestion at all, but prek could automatically suggest the right thing to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants