Skip to content

Commit 89719a4

Browse files
committed
Fix spacing for eval progress bar with standalone audit
1 parent 67e5e72 commit 89719a4

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

sqlmesh/core/console.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3354,7 +3354,13 @@ def _calculate_audit_str_len(batched_intervals: t.Dict[Snapshot, t.List[Interval
33543354
# until after evaluation occurs, but we must determine the annotation column width here.
33553355
# Therefore, we add enough padding for the longest possible audits result string.
33563356
audit_str_len = 0
3357+
audit_base_str_len = len(f", audits ") + 1 # +1 for check/X
33573358
for snapshot in batched_intervals:
3359+
if snapshot.is_audit:
3360+
# +1 for "1" audit count, +1 for red X
3361+
audit_str_len = max(
3362+
audit_str_len, audit_base_str_len + (2 if not snapshot.audit.blocking else 1)
3363+
)
33583364
if snapshot.is_model and snapshot.model.audits:
33593365
num_audits = len(snapshot.model.audits_with_args)
33603366
num_nonblocking_audits = sum(
@@ -3363,11 +3369,14 @@ def _calculate_audit_str_len(batched_intervals: t.Dict[Snapshot, t.List[Interval
33633369
if not audit[0].blocking
33643370
or ("blocking" in audit[1] and audit[1]["blocking"] == exp.false())
33653371
)
3366-
# make enough room for all audits to pass
3367-
audit_len = len(f", audits {CHECK_MARK}{str(num_audits)}")
3368-
if num_nonblocking_audits:
3369-
# and add enough room for all nonblocking audits to fail
3370-
audit_len += len(f" {RED_X_MARK}{str(num_nonblocking_audits)}") + 1
3372+
if num_audits == 1:
3373+
# +1 for "1" audit count, +1 for red X
3374+
audit_len = audit_base_str_len + (2 if num_nonblocking_audits else 1)
3375+
else:
3376+
audit_len = audit_base_str_len + len(str(num_audits))
3377+
if num_nonblocking_audits:
3378+
# +1 for space, +1 for red X
3379+
audit_len += len(str(num_nonblocking_audits)) + 2
33713380
audit_str_len = max(audit_str_len, audit_len)
33723381
return audit_str_len
33733382

0 commit comments

Comments
 (0)