You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support a configuration directory or configuration include files #3422
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.
Activity
asottile commentedon Mar 10, 2025
there are many duplicates including those turned up by your search term why this is intentionally not going to happen
please next time