Skip to content

Commit 2597572

Browse files
committed
refactor: cap checked values at 60 chars in the details block
Long commit subjects wrapped inside the fenced details block, misaligning the scope lines. Trimming the value at 60 characters keeps the full line (prefix + value + parentheses) short enough to stay on one line.
1 parent 775fc7f commit 2597572

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎main.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,12 +415,14 @@ def _markdown_details(results: list[ScopeResult]) -> str:
415415
return "\n".join(sections)
416416

417417

418-
def _scope_value(scope: ScopeResult, max_len: int = 80) -> str:
418+
def _scope_value(scope: ScopeResult, max_len: int = 60) -> str:
419419
"""First non-empty check value for a scope, trimmed to a single line.
420420
421421
The value is the concrete thing that was checked (PR title, commit
422422
subject, branch name, author name/email) and reads naturally next to
423-
the scope label in the success details.
423+
the scope label in the success details. The 60-character cap keeps the
424+
full line (prefix + value + parentheses) short enough to avoid wrapping
425+
in the fenced details block.
424426
"""
425427
for check in scope.checks:
426428
value = check.get("value", "")

‎main_test.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ def test_all_pass_groups_scopes_like_step_log(self):
659659
def test_all_pass_truncates_long_values(self):
660660
long_value = "x" * 200
661661
body = main.render_job_summary([pass_scope("Commit 1/1", value=long_value)])
662-
self.assertIn(f" ✔ Commit 1/1 ({'x' * 77}...)", body)
662+
self.assertIn(f" ✔ Commit 1/1 ({'x' * 57}...)", body)
663663

664664
def test_all_pass_without_value_shows_plain_label(self):
665665
body = main.render_job_summary([pass_scope("Branch")])

0 commit comments

Comments
 (0)