Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared cross-repository configuration for commitizen #434

Open
offbyone opened this issue Sep 28, 2021 · 1 comment
Open

Shared cross-repository configuration for commitizen #434

offbyone opened this issue Sep 28, 2021 · 1 comment
Labels
type: feature A new enhacement proposal

Comments

@offbyone
Copy link

Description

In order to maintain consistent commit message rules across repositories shared by a team, I'd like to configure commitizen (running as a pre-commit hook). The configuration should be configurable either in git repository metadata, pre-commit flags, or an environment variable.

An environment variable makes the most sense so that it can be maintained in a location-independent way; users may have their own configuration locations.

Note that this does not attempt to solve the problem of project members bypassing commitizen, since they can do that using git commit -N anyway, so we're assuming non-malicious committers here.

Possible Solution

I propose that commitizen support an environment variable to identify a .cz.toml (or other configuration file):

export COMMITIZEN_CONFIG_FILE=$SOME_SHARED_PATH/cz.toml

If the environment variable is set, and does not refer to an actual file, then commitizen should raise an error.

This environment variable can be set by any project environment configuration tool (I use direnv but autoenv works, as do many IDE runners).

Optionally, if there is a repository-level .cz.toml, it can include a key indicating that configuration should be provided by the environment:

[tool.commitizen]
external_configuration = true

When this is set, then the environment variable must be provided or commitizen will fail.

Additional context

N/A

Related Issue

@offbyone offbyone added the type: feature A new enhacement proposal label Sep 28, 2021
@Lee-W
Copy link
Member

Lee-W commented Oct 6, 2021

@woile This feature sounds good to me. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A new enhacement proposal
Projects
None yet
Development

No branches or pull requests

2 participants