Skip to main content

Commitizen plugin that links your Bitbucket commits with your Jira issues

Project description

cz-bitbucket-jira-plugin

A Commitizen plugin that links your Bitbucket commits with your Jira issues.

GIF

Installation

pip install cz-bitbucket-jira-plugin

Configuration

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.

Jira project key (optional)

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.

Minimum length for commit messages (optional)

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.

Usage

As it is a Commitizen plugin, you can:

cz

Customization

You can change some defaults of the plugin:

Prompt style

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

Commit types

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: change_type_map and change_type_order.

Change type map

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"
change_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.

Change type order

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"
change_type_order = [
    "Bug fixes",
    "New features",
    "Code refactoring"
]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cz_bitbucket_jira_plugin-1.0.0.tar.gz (124.4 kB view hashes)

Uploaded Source

Built Distribution

cz_bitbucket_jira_plugin-1.0.0-py3-none-any.whl (11.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page