Skip to content

Support a configuration directory or configuration include files #3422

Closed

Description

@ringerc

search you tried in the issue tracker

many including "shared", "share", "include file", "group", "compose", etc

describe your actual problem

pre-commit doesn't presently have a well supported method of sharing a subset of configuration across multiple repositories. In projects that are spread across many small git repositories, this can become awkward to manage, as it's desirable for a basic set of central checks to be provided, but repos tend to need their own additions or overrides.

It would be very helpful to be able to compose pre-commit configuration by defining a pre-commit hook that is actually just another pre-commit configuration. This could be done by allowing .pre-commit-hooks.yaml to contain an entry with language: pre-commit that embeds a pre-commit configuration excerpt in-line to serve as a base.

It's presently possible to compose pre-commit configuration in a few ways:

  • Have some external tool generate a .pre-commit.yaml from input template files, a config directory etc, where some parts are repo-local and some parts are synced from somewhere else. Cumbersome.
  • Use a local .pre-commit-config.yaml that has a system hook to invoke pre-commit -c .pre-commit-config-shared.yaml or similar. This doesn't work great, because it can't pass through pre-commit command line arguments to target specific hooks, run only specific phases, etc.

pre-commit --version

pre-commit 4.1.0

Activity

  1. asottile commented on Mar 10, 2025

    @asottile
    Member

    there are many duplicates including those turned up by your search term why this is intentionally not going to happen

    please next time

  2. locked as off topic and limited conversation to collaborators on Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions