Skip to content

Commit

Permalink
Merge pull request #8038 from Mab879/add_does_not_meet_to_contorleval
Browse files Browse the repository at this point in the history
Add better error messages to utils/controleval.py and add does not meet to stats output
  • Loading branch information
jan-cerny committed Jan 10, 2022
2 parents 521ced6 + 68bf173 commit f36ed14
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions utils/controleval.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ def calculate_stats(ctrls):
ctrlstats = collections.defaultdict(int)
ctrllist = collections.defaultdict(set)

if total == 0:
print("No controls founds with the given inputs. Maybe try another level.")
exit(1)

for ctrl in ctrls:
ctrlstats[str(ctrl.status)] += 1
ctrllist[str(ctrl.status)].add(ctrl)
Expand All @@ -83,6 +87,7 @@ def calculate_stats(ctrls):
print_specific_stat("Supported", ctrlstats[controls.Status.SUPPORTED], applicable)
print_specific_stat("Documentation", ctrlstats[controls.Status.DOCUMENTATION], applicable)
print_specific_stat("Inherently Met", ctrlstats[controls.Status.INHERENTLY_MET], applicable)
print_specific_stat("Does Not Meet", ctrlstats[controls.Status.DOES_NOT_MEET], applicable)
print_specific_stat("Partial", ctrlstats[controls.Status.PARTIAL], applicable)

applicablelist = ctrls - ctrllist[controls.Status.NOT_APPLICABLE]
Expand Down

0 comments on commit f36ed14

Please sign in to comment.