Skip to content

Commit

Permalink
feat: update default changelog titles
Browse files Browse the repository at this point in the history
  • Loading branch information
paduszyk committed May 24, 2024
1 parent 8cc46cd commit 8b05e9f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
15 changes: 11 additions & 4 deletions commitizen/cz/conventional_commits/conventional_commits.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,18 @@ class ConventionalCommitsCz(BaseCommitizen):
bump_map_major_version_zero = defaults.bump_map_major_version_zero
commit_parser = r"^((?P<change_type>feat|fix|refactor|perf|BREAKING CHANGE)(?:\((?P<scope>[^()\r\n]*)\)|\()?(?P<breaking>!)?|\w+!):\s(?P<message>.*)?" # 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:
Expand Down
15 changes: 15 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
},
)

0 comments on commit 8b05e9f

Please sign in to comment.