Skip to content

Instantly share code, notes, and snippets.

@dgwhited
Last active July 13, 2020 20:13
Show Gist options
  • Save dgwhited/3e51826ad5b3fb29d476817f88ac7f7f to your computer and use it in GitHub Desktop.
Save dgwhited/3e51826ad5b3fb29d476817f88ac7f7f to your computer and use it in GitHub Desktop.
from parliament import Policy
def run_parliament(policy_json, policy_name):
policy = Policy(policy_json)
policy.analyze()
# Assign finding details
findings = [
{
"issue": finding.issue,
"title": finding.title,
"severity": finding.severity,
"description": finding.description,
"detail": finding.detail,
"location": finding.location,
"policy_name": policy_name
}
for finding in policy.findings
]
# Deduplicate the findings for easy output
deduped_findings = []
for f in findings:
if f not in deduped_findings:
deduped_findings.append(f)
return deduped_findings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment