Skip to content

move cz_conventional_commit defaults out of project wide default #1042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ConventionalCommitsCz(BaseCommitizen):
bump_pattern = defaults.bump_pattern
bump_map = defaults.bump_map
bump_map_major_version_zero = defaults.bump_map_major_version_zero
commit_parser = defaults.commit_parser
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",
Expand Down
2 changes: 0 additions & 2 deletions commitizen/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,3 @@ class Settings(TypedDict, total=False):
)
change_type_order = ["BREAKING CHANGE", "Feat", "Fix", "Refactor", "Perf"]
bump_message = "bump: version $current_version → $new_version"

commit_parser = r"^((?P<change_type>feat|fix|refactor|perf|BREAKING CHANGE)(?:\((?P<scope>[^()\r\n]*)\)|\()?(?P<breaking>!)?|\w+!):\s(?P<message>.*)?" # noqa
10 changes: 5 additions & 5 deletions tests/test_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest
from jinja2 import FileSystemLoader

from commitizen import changelog, defaults, git
from commitizen import changelog, git
from commitizen.cz.conventional_commits.conventional_commits import (
ConventionalCommitsCz,
)
Expand Down Expand Up @@ -1079,8 +1079,8 @@ def test_invalid_tag_included_in_changelog():

@pytest.mark.parametrize("merge_prereleases", (True, False))
def test_generate_tree_from_commits(gitcommits, tags, merge_prereleases):
parser = defaults.commit_parser
changelog_pattern = defaults.bump_pattern
parser = ConventionalCommitsCz.commit_parser
changelog_pattern = ConventionalCommitsCz.bump_pattern
tree = changelog.generate_tree_from_commits(
gitcommits, tags, parser, changelog_pattern, merge_prerelease=merge_prereleases
)
Expand All @@ -1106,8 +1106,8 @@ def test_generate_tree_from_commits(gitcommits, tags, merge_prereleases):

def test_generate_tree_from_commits_with_no_commits(tags):
gitcommits = []
parser = defaults.commit_parser
changelog_pattern = defaults.bump_pattern
parser = ConventionalCommitsCz.commit_parser
changelog_pattern = ConventionalCommitsCz.bump_pattern
tree = changelog.generate_tree_from_commits(
gitcommits, tags, parser, changelog_pattern
)
Expand Down