Summary
Problem statement
First of all, kudos for reimplementing pre-commit in Rust! As usual, it is much faster than the original python implementation, and I like the extended funcionality (globs, env, etc.).
However, it seems like legacy mode (called "migration mode" in pre-commit) is not 100% supported:
- When installing either
pre-commit or prek, they rename pre-existing hook files to <hook_name>.legacy.
- On uninstall, the legacy hook is also restored by both.
- When
hook-impl is called, and the legacy hook is present, pre-commit executes it before the hooks in .pre-commit-config.yaml, while prek quietly ignores it.
Here's the location where this should be implemented, but there's only a TODO comment:
|
// TODO: run in legacy mode |
Context
In the project I'm working on, we were using a custom script to run pre-commit hooks. Recently, we have migrated to pre-commit, but we still have a couple harder-to-migrate hooks in the old system; having pre-commit run the old script from pre-commit.legacy made it possible to start using pre-commit in parallel to our older hooks. We're considering moving to prek, but not being able to run the legacy hooks is a deal-breaker until we're able to migrate all our hooks to the new system, which may take a while.
Request
I think prek missing this feature should be called out in the Differences section of the documentation.
In addition, it would be great if you could add support for legacy hooks. I'm also interested in any ideas for a workaround with the current feature set that would allow us to migrate from pre-commit to prek while still running our legacy hooks.
Thanks in advance!
Willing to submit a PR?
Platform
Windows 11 x86_64 / macOS 15.5 arm64
Version
prek 0.3.3
.pre-commit-config.yaml
n/a
Log file
n/a
Summary
Problem statement
First of all, kudos for reimplementing
pre-commitin Rust! As usual, it is much faster than the original python implementation, and I like the extended funcionality (globs, env, etc.).However, it seems like legacy mode (called "migration mode" in
pre-commit) is not 100% supported:pre-commitorprek, they rename pre-existing hook files to<hook_name>.legacy.hook-implis called, and the legacy hook is present,pre-commitexecutes it before the hooks in.pre-commit-config.yaml, whileprekquietly ignores it.Here's the location where this should be implemented, but there's only a TODO comment:
prek/crates/prek/src/cli/hook_impl.rs
Line 36 in e290094
Context
In the project I'm working on, we were using a custom script to run pre-commit hooks. Recently, we have migrated to
pre-commit, but we still have a couple harder-to-migrate hooks in the old system; havingpre-commitrun the old script frompre-commit.legacymade it possible to start usingpre-commitin parallel to our older hooks. We're considering moving toprek, but not being able to run the legacy hooks is a deal-breaker until we're able to migrate all our hooks to the new system, which may take a while.Request
I think
prekmissing this feature should be called out in the Differences section of the documentation.In addition, it would be great if you could add support for legacy hooks. I'm also interested in any ideas for a workaround with the current feature set that would allow us to migrate from
pre-committoprekwhile still running our legacy hooks.Thanks in advance!
Willing to submit a PR?
Platform
Windows 11 x86_64 / macOS 15.5 arm64
Version
prek 0.3.3
.pre-commit-config.yaml
n/a
Log file
n/a