Skip to content

Commit 78946d1

Browse files
committed
refactor(conventional_commits): make schema_pattern more readable
1 parent a3919c9 commit 78946d1

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
@@ -185,11 +185,27 @@ def schema(self) -> str:
185185
)
186186

187187
def schema_pattern(self) -> str:
188+
change_types = (
189+
"build",
190+
"bump",
191+
"chore",
192+
"ci",
193+
"docs",
194+
"feat",
195+
"fix",
196+
"perf",
197+
"refactor",
198+
"revert",
199+
"style",
200+
"test",
201+
)
188202
return (
189203
r"(?s)" # To explicitly make . match new line
190-
r"(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)" # type
191-
r"(\(\S+\))?!?:" # scope
192-
r"( [^\n\r]+)" # subject
204+
r"(" + "|".join(change_types) + r")" # type
205+
r"(\(\S+\))?" # scope
206+
r"!?"
207+
r": "
208+
r"([^\n\r]+)" # subject
193209
r"((\n\n.*)|(\s*))?$"
194210
)
195211

0 commit comments

Comments
 (0)