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 cdec1a0

Browse files
refactor(conventional_commits): make schema_pattern more readable
1 parent a9cd957 commit cdec1a0

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

‎commitizen/cz/conventional_commits/conventional_commits.py‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,27 @@ def schema(self) -> str:
174174
)
175175

176176
def schema_pattern(self) -> str:
177+
change_types = (
178+
"build",
179+
"bump",
180+
"chore",
181+
"ci",
182+
"docs",
183+
"feat",
184+
"fix",
185+
"perf",
186+
"refactor",
187+
"revert",
188+
"style",
189+
"test",
190+
)
177191
return (
178192
r"(?s)" # To explicitly make . match new line
179-
r"(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)" # type
180-
r"(\(\S+\))?!?:" # scope
181-
r"( [^\n\r]+)" # subject
193+
r"(" + "|".join(change_types) + r")" # type
194+
r"(\(\S+\))?" # scope
195+
r"!?"
196+
r": "
197+
r"([^\n\r]+)" # subject
182198
r"((\n\n.*)|(\s*))?$"
183199
)
184200

0 commit comments

Comments
(0)

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