@@ -39,8 +39,6 @@ def analyze_licenses_and_sources(self):
3939 util.analyze_compliance_licenses(self.project)
4040"""
4141
42- COMPLIANCE_ORDER = ["warning" , "error" , "missing" ]
43-
4442
4543def flag_compliance_files (project ):
4644 """Flag compliance files status for the provided `project`."""
@@ -74,19 +72,24 @@ def group_compliance_alerts_by_severity(queryset):
7472 string representations of the instances associated with that severity.
7573 """
7674 compliance_alerts = defaultdict (list )
75+
76+ # Values are sorted in lexicographical order.
77+ queryset_labels_sorted = sorted ([label for label in queryset .keys ()])
7778 for instance in queryset :
7879 compliance_alerts [instance .compliance_alert ].append (str (instance ))
7980
80- sorted_compliance_alerts = sorted (compliance_alerts .items (), key = lambda x : COMPLIANCE_ORDER .index (x [0 ]))
81- return dict (sorted_compliance_alerts )
81+ sorted_compliance_alerts = {
82+ label : compliance_alerts [label ] for label in queryset_labels_sorted
83+ }
84+ return sorted_compliance_alerts
8285
8386
8487def get_project_compliance_alerts (project , fail_level = "error" ):
8588 """
8689 Retrieve compliance alerts for a given project at a specified severity level.
8790
8891 This function checks for compliance alerts in the provided project, filtering them
89- by the specified severity level (e.g., "error", "warning"). It gathers compliance
92+ by the specified severitylexograhpical level (e.g., "error", "warning"). It gathers compliance
9093 alerts for both discovered packages and codebase resources, and returns them in
9194 a structured dictionary.
9295 """
0 commit comments