fix: align freshness details in one column

This commit is contained in:
Abdessamad Derraz committed 2026-11-05 11:49:45 +01:00
1 parent 651b1404db
commit 92ee0cf118
2 files changed
+12 -2

No files matched your search

+4 -2
View File
@@ -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}"
+8
View File
@@ -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)