Skip to content

Commit d68aa6e

Browse files
committed
Fix commit status to count new + unchanged alerts when strict blocking enabled
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
1 parent 92c0335 commit d68aa6e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

socketsecurity/socketcli.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,11 +649,20 @@ def main_code():
649649
scm.enable_merge_pipeline_check()
650650
passed = output_handler.report_pass(diff)
651651
state = "success" if passed else "failed"
652-
blocking_count = sum(1 for a in diff.new_alerts if a.error)
652+
new_blocking = sum(1 for a in diff.new_alerts if a.error)
653+
unchanged_blocking = 0
654+
if config.strict_blocking and hasattr(diff, 'unchanged_alerts'):
655+
unchanged_blocking = sum(1 for a in diff.unchanged_alerts if a.error)
656+
blocking_count = new_blocking + unchanged_blocking
653657
if passed:
654658
description = "No blocking issues"
655659
else:
656-
description = f"{blocking_count} blocking alert(s) found"
660+
parts = []
661+
if new_blocking:
662+
parts.append(f"{new_blocking} new")
663+
if unchanged_blocking:
664+
parts.append(f"{unchanged_blocking} existing")
665+
description = f"{blocking_count} blocking alert(s) found ({', '.join(parts)})"
657666
target_url = diff.report_url or diff.diff_url or ""
658667
scm.set_commit_status(state, description, target_url)
659668

0 commit comments

Comments
 (0)