Description
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