Skip to content

Commit

Permalink
Fix: Inspector findings export not sorted correctly (#6170, PR #6175)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes-ucsc committed Apr 24, 2024
2 parents 883802b + c47f3ed commit 9149d91
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/export_inspector_findings.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ def column_alpha(self, col: int) -> str:

def findings_sort(self, item: tuple[str, list[SummaryType]]) -> tuple[int, str]:
score = 0
weights = {'HIGH': 1, 'CRITICAL': 10}
for summary in item[1]:
score += 10 if summary['severity'] == 'CRITICAL' else 0
score += 1 if summary['severity'] == 'HIGH' else 0
count = len(summary['resources'])
score += count * weights.get(summary['severity'], 0)
return score, item[0]

def write_to_csv(self, findings: dict[str, list[SummaryType]]) -> None:
Expand Down

0 comments on commit 9149d91

Please sign in to comment.