Skip to content

Commit 94f8ae0

Browse files
josixLee-W
authored andcommitted
feat(cz_check): Update to show all ill-formatted commits
1 parent 09cf7b3 commit 94f8ae0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

commitizen/commands/check.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,17 @@ def __call__(self):
5050
raise NoCommitsFoundError(f"No commit found with range: '{self.rev_range}'")
5151

5252
pattern = self.cz.schema_pattern()
53+
ill_formated_commits = []
5354
for commit_msg in commit_msgs:
5455
if not Check.validate_commit_message(commit_msg, pattern):
55-
raise InvalidCommitMessageError(
56-
"commit validation: failed!\n"
57-
"please enter a commit message in the commitizen format.\n"
58-
f"commit: {commit_msg}\n"
59-
f"pattern: {pattern}"
60-
)
56+
ill_formated_commits.append(f"commit: {commit_msg}\n")
57+
if ill_formated_commits != []:
58+
raise InvalidCommitMessageError(
59+
"commit validation: failed!\n"
60+
"please enter a commit message in the commitizen format.\n"
61+
f"{''.join(ill_formated_commits)}\n"
62+
f"pattern: {pattern}"
63+
)
6164
out.success("Commit validation: successful!")
6265

6366
def _get_commit_messages(self):

0 commit comments

Comments
 (0)