Skip to content

Commit

Permalink
Add better error messages to utils/controleval.py and add does not meet
Browse files Browse the repository at this point in the history
Adds an error message for the case when the a policy has a level
defined but has no controls. This commit also adds the 'does not meet'
to the stats output
  • Loading branch information
Mab879 committed Jan 7, 2022
1 parent 72bada9 commit 56d9bb3
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 @@ -42,6 +42,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 @@ -60,6 +64,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 Met", 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 56d9bb3

Please sign in to comment.