Skip to content

Commit

Permalink
merge: #2 from dev
Browse files Browse the repository at this point in the history
  • Loading branch information
alycejenni authored Oct 23, 2024
2 parents 56ac23d + 8c1b029 commit 226091e
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions cz_nhm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from commitizen.cz.base import BaseCommitizen
from commitizen.cz.utils import multiple_line_breaker, required_validator
from commitizen import defaults as cz_defaults
from collections import OrderedDict

# CHANGE TYPES =========================================================================

Expand Down Expand Up @@ -89,10 +91,11 @@ def parse_scope(text):


class NHMCz(BaseCommitizen):
bump_pattern = (
rf'^({"|".join([c.short_name for c in change_types if c.bump_type])})'
bump_pattern = cz_defaults.bump_pattern
bump_map = OrderedDict(
[(r'^.+!$', 'MAJOR')]
+ [(f'^{c.short_name}', c.bump_type) for c in change_types if c.bump_type]
)
bump_map = {c.short_name: c.bump_type for c in change_types if c.bump_type}
commit_parser = rf'^(?P<change_type>{"|".join([c.short_name for c in change_types if c.display_name])})(?:\((?P<scope>[^)\r\n]+)\))?: (?P<message>[^\n]+)'
changelog_pattern = (
rf'^({"|".join([c.short_name for c in change_types if c.display_name])})'
Expand Down Expand Up @@ -163,11 +166,11 @@ def message(self, answers: dict) -> str:
if scope:
message += f'({scope})'
message += f': {subject}'
if body:
message += f'\n\n{body}'
if is_breaking_change:
# repeat the subject so the changelog can pick it up
message += f'\n\nBREAKING CHANGE: {subject}'
if body:
message += f'\n\n{body}'
if len(issues) > 0:
message += f'\n\nCloses: #{", #".join(issues)}'

Expand All @@ -190,13 +193,13 @@ def schema(self) -> str:
Used by cz schema.
"""
return (
"<type>(<scope>): <subject>\n"
"<BLANK LINE>\n"
"BREAKING CHANGE: <subject>\n"
"<BLANK LINE>\n"
"<body>\n"
"<BLANK LINE>\n"
"Closes: <issues>"
'<type>(<scope>): <subject>\n'
'<BLANK LINE>\n'
'<body>\n'
'<BLANK LINE>\n'
'BREAKING CHANGE: <subject>\n'
'<BLANK LINE>\n'
'Closes: <issues>'
)

def schema_pattern(self) -> str:
Expand Down

0 comments on commit 226091e

Please sign in to comment.