Skip to content

Commit 681bf18

Browse files
committed
feat: reduce the report table to failed scopes
Passing scopes no longer pad the failure table with dash rows; the table lists only the failed scopes with their checked value and rule links, while the collapsible details block keeps the full pass/fail picture in step-log style.
1 parent bbba5cd commit 681bf18

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

‎main.py‎

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -382,26 +382,22 @@ def _failure_count(results: list[ScopeResult]) -> int:
382382

383383

384384
def _markdown_table(results: list[ScopeResult]) -> str:
385-
"""Render the scope/result table shared by summary and PR comment.
385+
"""Render the failure table shared by summary and PR comment.
386386
387-
The checked-value column only fills failed scopes: pass scopes keep a
388-
dash so the failure stands out, and the full per-scope values live in
389-
the collapsible details block.
387+
Only failed scopes appear in the table so the failure stands out; the
388+
full pass/fail picture lives in the collapsible details block.
390389
"""
391390
rows = [
392391
"| Scope | Checked value | Failed checks | Result |",
393392
"|---|---|---|---|",
394393
]
395394
for scope in results:
396395
if scope.status == "pass":
397-
rows.append(f"| {scope.label} | \u2014 | \u2014 | \u2705 |")
398-
else:
399-
value = _scope_value(scope)
400-
value_display = f"`{value}`" if value else "\u2014"
401-
links = " \u00b7 ".join(
402-
_rule_markdown_link(check) for check in scope.failures
403-
)
404-
rows.append(f"| {scope.label} | {value_display} | {links} | \u274c |")
396+
continue
397+
value = _scope_value(scope)
398+
value_display = f"`{value}`" if value else "\u2014"
399+
links = " \u00b7 ".join(_rule_markdown_link(check) for check in scope.failures)
400+
rows.append(f"| {scope.label} | {value_display} | {links} | \u274c |")
405401
return "\n".join(rows)
406402

407403

‎main_test.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,11 @@ def test_failure_details_show_all_scopes_and_values(self):
695695

696696
def test_pass_scope_renders_checkmark_without_value(self):
697697
body = main.render_job_summary([pass_scope("Branch"), fail_scope("Commit 1/1")])
698-
self.assertIn("| Branch | — | — | ✅ |", body)
698+
# Pass scopes stay out of the table; the details block carries them.
699+
table = body.split("<details>")[0]
700+
self.assertNotIn("| Branch |", table)
701+
self.assertIn("| Commit 1/1 | `bad message` |", table)
702+
self.assertIn("✔ Branch", body)
699703

700704

701705
class TestRenderPrComment(unittest.TestCase):

0 commit comments

Comments
 (0)