Skip to content

make stages and hook-type match #2732

Open
@asottile

Description

@asottile

this is mostly a confusion point / slightly annoying and a mistake I made when first introducing new hook types

currently all of the --hook-type and stages values match except for these three:

  • pre-commit: commit
  • pre-merge-commit: merge-commit
  • pre-push: push

I'd like to deprecate the mismatched names!

this is going to need a long deprecation period since it's sorta subtle and usually not the user's fault and will need hook authors to (potentially) make updates

the plan is to do the following:

  1. introduce the following in a minor release
    • no deprecation notice in this initial release (give authors / users some time to update without warnings)
    • the new names are available in addition to the old names
    • migrate-config will autofix .pre-commit-config.yaml usages of stages with the old values (there isn't an equivalent migrate-manifest -- though users outnumber hook authors by several orders of magnitude)
  2. introduce the following in a minor release
    • a warning is shown for configuration using the old stages names
    • a warning is shown for repos using the old stages names (do this at install time so it only shows once as to not be super annoying for users who have no control)
    • a recommendation for hook authors to also set minimum_pre_commit_version to this version
  3. a long time passes (typically my deprecation period has been 12-18+ months)
  4. introduce the following in a major release
    • removal of the old names

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      make `stages` and `hook-type` match · Issue #2732 · pre-commit/pre-commit