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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file cz_bitbucket_jira_plugin-1.0.0.tar.gz.

File metadata

  • Download URL: cz_bitbucket_jira_plugin-1.0.0.tar.gz
  • Upload date:
  • Size: 124.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for cz_bitbucket_jira_plugin-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ba5bbe843c0f8d9f499f91f7fb8a3927872573e1486c737c812245b571df546f
MD5 75e1fa7bd6b1eb5af35da7df4d73cc9b
BLAKE2b-256 d82e6176443354229d5c0d874c8e073d1e1b3a5fe6dd9dad58b618d04bbfd9c0

See more details on using hashes here.

File details

Details for the file cz_bitbucket_jira_plugin-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cz_bitbucket_jira_plugin-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f131f6b5798460360826f1d14c0929868b00799c561da6858efad9414016dcd4
MD5 6e3bdfb874715fda0fee73aa1c88bbc8
BLAKE2b-256 4231ef7bc6d1040cf4779a48472206c5d51649ff6cdd93df13a5d0a53efc6649

See more details on using hashes here.

Supported by

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