Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 939ee43

Browse files
bearomorphismLee-W
authored andcommitted
refactor(ConventionalCommitsCz): rewrite message method to make the pattern more clear
1 parent e98741c commit 939ee43

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

‎commitizen/cz/conventional_commits/conventional_commits.py‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,16 @@ def message(self, answers: ConventionalCommitsAnswers) -> str: # type: ignore[o
155155
is_breaking_change = answers["is_breaking_change"]
156156

157157
if scope:
158-
scope = f"({scope})"
159-
if body:
160-
body = f"\n\n{body}"
158+
# example: "fix(users): email pattern corrected"
159+
first_line = f"{prefix}({scope}): {subject}"
160+
else:
161+
# example: "fix: email pattern corrected"
162+
first_line = f"{prefix}: {subject}"
163+
161164
if is_breaking_change:
162165
footer = f"BREAKING CHANGE: {footer}"
163-
if footer:
164-
footer = f"\n\n{footer}"
165166

166-
return f"{prefix}{scope}: {subject}{body}{footer}"
167+
return "\n\n".join(sforsin (first_line, body, footer) ifs)
167168

168169
def example(self) -> str:
169170
return (

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /