Skip to content

Commit 583c38a

Browse files
feat: sorting the compliance using the alert labels
Signed-off-by: AbanoubAziz <abanoubsamy2341@gmail.com>
1 parent 16ed5c4 commit 583c38a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

scanpipe/pipes/compliance.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ def analyze_licenses_and_sources(self):
3939
util.analyze_compliance_licenses(self.project)
4040
"""
4141

42+
COMPLIANCE_ORDER = ["warning", "error", "missing"]
43+
4244

4345
def flag_compliance_files(project):
4446
"""Flag compliance files status for the provided `project`."""
@@ -74,7 +76,9 @@ def group_compliance_alerts_by_severity(queryset):
7476
compliance_alerts = defaultdict(list)
7577
for instance in queryset:
7678
compliance_alerts[instance.compliance_alert].append(str(instance))
77-
return dict(compliance_alerts)
79+
80+
sorted_compliance_alerts = sorted(compliance_alerts.items(), key=lambda x: COMPLIANCE_ORDER.index(x[0]))
81+
return dict(sorted_compliance_alerts)
7882

7983

8084
def get_project_compliance_alerts(project, fail_level="error"):

0 commit comments

Comments
 (0)