Extends Conventional Commits Change Types with User-Defined Legacy Types for Commitizen
Project description
cz_legacy
Custom Commitizen parser for user-specified legacy change types. The parser utilizes the cz_conventional_commits
pattern and extends with the tag mapping specified in the configuration file
While old change types will appear in the Changelog, the user will be prevented from using them in new commits. This is the reverse of the revert
/chore
logic from commitizen that allows use of those commit types, but won't display them in the changelog
Alternatives
This customization only works when old commits use the <change_type>: <message>
format that can be parsed by commitizen. If that doesn't fit your use case, you may want to try out incremental which doesn't modify existing portions of a CHANGELOG
Usage
Install
Install the package from PyPi: pip install cz_legacy
or from git: pip install git+https://github.com/KyleKing/cz_legacy.git@main
Configuration
At minimum, you must have the name = "cz_legacy"
and [tool.commitizen.cz_legacy_map]
in your configuration file. The below example is for TOML, you can also utilize a YAML or JSON file.
Below is an example of the three change legacy types Chg, Fix, and New, but the user can choose any tag names and associated mapping for the Changelog
[tool.commitizen]
name = "cz_legacy"
# Other tool.commitizen configuration options
[tool.commitizen.cz_legacy_map]
Chg = "Change (old)"
Fix = "Fix (old)"
New = "New (old)"
Pre-Commit
To use in pre-commit, add this to your pre-commit-config.yml
repos:
- repo: https://github.com/commitizen-tools/commitizen
rev: v2.11.1
hooks:
- id: commitizen
additional_dependencies: ["cz_legacy"]
stages: [commit-msg]
Issues
If you have any feature requests, run into any bugs, or have questions, feel free to start a discussion or open an issue on Github at https://github.com/kyleking/calcipy.
Background
I couldn't find a good way of adding a few legacy change types from an old commit style to commitizen so I built a package to extend the ConventionalCommitsCz
to provide custom logic. For reference, these are the default settings
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cz_legacy-0.1.0rc0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d42e3f9aaa0e43ed040940f039373d9a46fd645752caf0c0efd778676516ff5 |
|
MD5 | 840a894e3a856d648b6862dac35141e0 |
|
BLAKE2b-256 | c7eb314d3afda2b6915aec957aac8258376673164d810a94e69e42a3cfdea0fe |