From 92ee0cf118518659c156765a83b67e5b6722c484 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Thu, 5 Nov 2026 11:49:45 +0100 Subject: [PATCH] fix: align freshness details in one column --- scripts/check_freshness.py | 6 ++++-- tests/test_check_freshness.py | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/check_freshness.py b/scripts/check_freshness.py index a91875ab4..57b77e65e 100644 --- a/scripts/check_freshness.py +++ b/scripts/check_freshness.py @@ -1407,8 +1407,10 @@ def render(findings: list[Finding]) -> str: cols = f" {f.status:7} {f.subject:{width}}" if f.remote: cols += f" {f.local:{local_width}} -> {f.remote}" - elif f.local: - # An arrow pointing at nothing read as a lost value. + elif f.local or (f.detail and local_width): + # An arrow pointing at nothing read as a lost value. An empty + # local value still takes its column, or the detail starts + # where the other rows show theirs. cols += f" {f.local:{local_width}}" if f.detail: cols += f" {f.detail}" diff --git a/tests/test_check_freshness.py b/tests/test_check_freshness.py index 33871a167..d1d58d421 100644 --- a/tests/test_check_freshness.py +++ b/tests/test_check_freshness.py @@ -621,6 +621,14 @@ class RowsSayAllTheyStandFor(unittest.TestCase): ]) self.assertNotIn("->", text) + def test_a_detail_starts_in_one_column(self): + text = cf.render([ + cf.Finding("native", "amberelec", cf.STALE, detail="no longer matches"), + cf.Finding("native", "bizhawk", cf.STALE, local="1 file(s)", detail="is not what"), + ]) + rows = [line for line in text.splitlines() if line.startswith(" STALE")] + self.assertEqual(rows[0].index("no longer"), rows[1].index("is not what")) + def test_json_carries_every_unresolved_name(self): missing = {f"core{i:02d}": [] for i in range(50)} (row,) = cf._unresolved_findings("retropie", missing)