From 8b05e9f484dee69e869dac15f40494c4c37c0bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Paduszyn=CC=81ski?= Date: Fri, 24 May 2024 14:28:24 +0200 Subject: [PATCH] feat: update default changelog titles --- .../conventional_commits/conventional_commits.py | 15 +++++++++++---- tests/conftest.py | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/commitizen/cz/conventional_commits/conventional_commits.py b/commitizen/cz/conventional_commits/conventional_commits.py index dcfd7bab8..2af149d09 100644 --- a/commitizen/cz/conventional_commits/conventional_commits.py +++ b/commitizen/cz/conventional_commits/conventional_commits.py @@ -33,11 +33,18 @@ class ConventionalCommitsCz(BaseCommitizen): bump_map_major_version_zero = defaults.bump_map_major_version_zero commit_parser = r"^((?Pfeat|fix|refactor|perf|BREAKING CHANGE)(?:\((?P[^()\r\n]*)\)|\()?(?P!)?|\w+!):\s(?P.*)?" # noqa change_type_map = { - "feat": "Feat", - "fix": "Fix", - "refactor": "Refactor", - "perf": "Perf", + "feat": "New features", + "fix": "Bug fixes", + "refactor": "Code refactoring", + "perf": "Performance improvements", } + change_type_order = [ + "BREAKING CHANGE", + "New features", + "Bug fixes", + "Code refactoring", + "Performance improvements", + ] changelog_pattern = defaults.bump_pattern def questions(self) -> Questions: diff --git a/tests/conftest.py b/tests/conftest.py index cc306ac6d..26e537a5d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -17,6 +17,7 @@ from commitizen.config import BaseConfig from commitizen.cz import registry from commitizen.cz.base import BaseCommitizen +from commitizen.cz.conventional_commits import ConventionalCommitsCz from tests.utils import create_file_and_commit SIGNER = "GitHub Action" @@ -253,3 +254,17 @@ def any_changelog_format(config: BaseConfig) -> ChangelogFormat: """For test not relying on formats specifics, use the default""" config.settings["changelog_format"] = defaults.CHANGELOG_FORMAT return get_changelog_format(config) + + +@pytest.fixture(autouse=True) +def default_change_type_map(mocker: MockerFixture) -> None: + mocker.patch.object( + ConventionalCommitsCz, + "change_type_map", + { + "feat": "Feat", + "fix": "Fix", + "refactor": "Refactor", + "perf": "Perf", + }, + )