A Commitizen plugin that links your Bitbucket commits with your Jira issues.
pip install cz-bitbucket-jira-plugin
Theres 2 possible configuration files: pyproject.toml
and cz.toml
. It's up to you.
Tip
If you already have a pyproject.toml
in your project, use it. If not, create a cz.toml
.
The only required configurations are:
[tool.commitizen]
name = "cz-bitbucket-jira-plugin"
jira_url = "https://<project name>.atlassian.net"
This tells Commitizen which plugin you want to use and what is your Jira url, to properly link issues on commit messages and Changelog.
To avoid the need to type your Jira project key for every commit, you can set this up in your chosen configuration file:
[tool.commitizen]
name = "cz-bitbucket-jira-plugin"
jira_project_key = "DEV"
Now every time you execute cz commit
, Commitizen will use the cz-bitbucket-jira-plugin and use "DEV" as your default Jira project key.
You can set a minimum length for commit messages to prevent things like "fix"
, "wip"
, "test"
, "aaa"
, and so on...
To do this, set this up in your chosen configuration file:
[tool.commitizen]
name = "cz-bitbucket-jira-plugin"
commit_message_minimum_length = 32
The default value for this config is 32
.
As it is a Commitizen plugin, you can:
cz
You can change some defaults of the plugin:
To change the default prompt style which is:
prompt_style = [
{ identifier = "qmark", style = "fg:#FF5555" },
{ identifier = "question", style = "fg:#BD93F9" },
{ identifier = "answer", style = "fg:#F8F8F2 nobold" },
{ identifier = "pointer", style = "fg:#50FA7B nobold" },
{ identifier = "highlighted", style = "fg:#50FA7B" },
{ identifier = "selected", style = "fg:#50FA7B" },
{ identifier = "separator", style = "fg:#858585" },
{ identifier = "instruction", style = "fg:#858585 nobold" },
{ identifier = "text", style = "fg:#F8F8F2" },
{ identifier = "disabled", style = "fg:#858585 italic" },
]
You can create the prompt_style
key in your config file. This key must be an array of inline tables. Each inline table must have two pair of key/value.
Example:
[tool.commitizen]
name = "cz-bitbucket-jira-plugin"
prompt_style = [
{ identifier = "question", style = "fg:#50FA7B bold" },
{ identifier = "answer", style = "fg:#F8F8F2 nobold" }
]
The available identifiers are:
- qmark
- question
- answer
- pointer
- highlighted
- selected
- separator
- instruction
- text
- disabled
You can check this also on https://questionary.readthedocs.io/en/stable/pages/advanced.html#themes-styling
For the complete styling documentation check https://python-prompt-toolkit.readthedocs.io/en/stable/pages/advanced_topics/styling.html
To change the default commit types which is:
commit_types = [
{ value = "init", name = "init: initial commit to set up your repository" },
{ value = "feat", name = "feat: introduce a new feature" },
{ value = "fix", name = "fix: fix a bug" },
{ value = "docs", name = "docs: add or update documentation" },
{ value = "typo", name = "typo: fix typos" },
{ value = "refactor", name = "refactor: code refactoring" },
{ value = "perf", name = "perf: code refactoring that improves performance" },
{ value = "delete", name = "delete: code or file deletion" },
{ value = "test", name = "test: add or update tests" },
{ value = "misc", name = "misc: changes that do not affect the code itself (e.g.: add .gitignore)" },
{ value = "style", name = "style: changes on code styling (e.g.: formatting, white-spaces)" }
]
You can create the commit_types
key in your config file. This key must be an array of inline tables. Each inline table must have two pair of key/value, and the key names must be: value and name. Must be these names (at least for now).
Example:
[tool.commitizen]
name = "cz-bitbucket-jira-plugin"
commit_types = [
{ value = "feat", name = "feat: introduce a new feature" },
{ value = "fix", name = "fix: fix a bug" },
{ value = "refactor", name = "refactor: code refactoring" }
]
Important
If you change the default commit types you will also need to declare two other keys: changelog_type_map
and changelog_type_order
.
Array of inline tables that have an key map for each commit type. Using the commit types on the example above:
[tool.commitizen]
name = "cz-bitbucket-jira-plugin"
changelog_type_map = [
{ value = "feat", name = "New features" },
{ value = "fix", name = "Bug fixes" },
{ value = "refactor", name = "Code refactoring" }
]
The value
are the commit type and name
are the long name that will appear in the Changelog.
Array containing the order you want to show in the Changelog.
If you think that bug fixes are more important than new features you can show them first on Changelog:
[tool.commitizen]
name = "cz-bitbucket-jira-plugin"
changelog_type_order = [
"Bug fixes",
"New features",
"Code refactoring"
]