fix: keep freshness values whole

This commit is contained in:
Abdessamad Derraz committed 2026-10-17 12:44:45 +02:00
1 parent feb3b03a39
commit 43647eb781
2 files changed
+13 -2

No files matched your search

+5 -2
View File
@@ -1037,10 +1037,13 @@ def render(findings: list[Finding]) -> str:
if not rows:
continue
lines.append(f"\n[{area}]")
# Columns are padded, never cut: the profile_sync row says in its
# local and remote values what to re-read, and lost the end of it.
local_width = min(max((len(f.local) for f in rows), default=0), 44)
for f in rows:
cols = f" {f.status:7} {f.subject[:width]:{width}}"
cols = f" {f.status:7} {f.subject:{width}}"
if f.local or f.remote:
cols += f" {f.local[:32]:32} -> {f.remote[:32]}"
cols += f" {f.local:{local_width}} -> {f.remote}"
if f.detail:
cols += f" {f.detail}"
lines.append(cols.rstrip())
+8
View File
@@ -303,6 +303,14 @@ class RepositoryWiringTests(unittest.TestCase):
self.assertIn("[ci]", text)
self.assertIn("[data]", text)
def test_render_keeps_long_values_whole(self):
"""The profile_sync row lost the end of its sentence at 32 characters."""
local = "12 profiles behind upstream, 103 refs to re-read"
text = cf.render([cf.Finding("profiles", "profile_sync", cf.STALE, local=local,
remote="run profile_sync --all --triage")])
self.assertIn(local, text)
self.assertIn("run profile_sync --all --triage", text)
class RepeatedDestinations(unittest.TestCase):
def test_a_change_to_an_earlier_declaration_is_seen(self):