Skip to content

Legacy mode is not implemented #1700

@petamas

Description

@petamas

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?

  • Yes — I’m willing to open a PR to fix this.

Platform

Windows 11 x86_64 / macOS 15.5 arm64

Version

prek 0.3.3

.pre-commit-config.yaml

n/a

Log file

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions