Skip to content

Commit 7216a50

Browse files
committed
fix: update output formatting in PR message checks to include commit indexing
1 parent 94942c6 commit 7216a50

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

main.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,16 @@ def run_pr_message_checks(pr_messages: list[str], result_file: TextIO) -> int:
156156
"""
157157
has_failure = False
158158
emitted_failure_output = False
159-
for msg in pr_messages:
159+
total = len(pr_messages)
160+
for index, msg in enumerate(pr_messages, start=1):
160161
command_args = ["--message"]
161162
if emitted_failure_output:
162163
command_args.append("--no-banner")
163164

164-
output_prefix = COMMIT_SECTION_SEPARATOR if emitted_failure_output else None
165+
if emitted_failure_output:
166+
output_prefix = f"\n--- Commit {index}/{total}:\n"
167+
else:
168+
output_prefix = None
165169

166170
return_code = run_check_command(
167171
command_args,

main_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def test_later_failure_prefix_uses_short_separator_without_extra_blank_lines(sel
170170
output = result_file.getvalue()
171171
self.assertIn("Commit rejected.\n", output)
172172
self.assertIn(
173-
f"{main.COMMIT_SECTION_SEPARATOR}Type subject_imperative check failed ==> bad third\n",
173+
"\n--- Commit 3/3:\nType subject_imperative check failed ==> bad third\n",
174174
output,
175175
)
176176
self.assertNotIn(

0 commit comments

Comments
 (0)