commitizen icon indicating copy to clipboard operation
commitizen copied to clipboard

Change default `bump_message` for plugin

Open ghisvail opened this issue 2 years ago • 2 comments

Description

I designed a Commitizen plugin and would like to implement a restriction on bump commits.

So far, I know I can use:

# pyproject.toml

[tool.commitizen]
name = "cz_pydata"
bump_message = "REL: Release version $new_version"

But it would be up to individual projects to explicitly override bump_message to get cz bump --changelog to produce a bump message compliant with the PyData spec.

Possible Solution

Instead, I would like to set this template as default for cz_pydata so that configuring the project with:

# pyproject.toml

[tool.commitizen]
name = "cz_pydata"

and running cz bump --changelog would produce a commit formatted as REL: Release version $new_version.

Even better if bump_message remains overridable for projects using additional markers like [skip ci].

Additional context

No response

Additional context

No response

ghisvail avatar Dec 17 '23 09:12 ghisvail

I tried the following (based on how default_style_config works), but it did not work:

class PydataCz(BaseCommitizen):

    default_bump_message = "REL: Release version $new_version"

    def __init__(self, config: BaseConfig):
        super().__init__(config)

        if not self.config.settings.get("bump_message"):
            self.config.update({"bump_message": PydataCz.default_bump_message})

ghisvail avatar Dec 17 '23 22:12 ghisvail

Hi @ghisvail , thanks for reporting this. I just traced the code a bit. This is not doable as of now, and I think this is a valid enhancement we can have. Would you like to create a PR and make this enhancement?

Lee-W avatar May 20 '24 20:05 Lee-W