add defaultdict
import argparse
import itertools
import json
+from collections import defaultdict
from json import dumps
import logging
import os
@@ -107,7 +108,7 @@ class RunnerRegistry:
sarif_reports = []
junit_reports = []
cyclonedx_reports = []
- data_outputs = {}
+ data_outputs = defaultdict(str)
for report in scan_reports:
if not report.is_empty():
if "json" in config.output:
@@ -116,10 +117,6 @@ class RunnerRegistry:
junit_reports.append(report)
# report.print_junit_xml()
if "github_failed_only" in config.output:
- if "github_failed_only" not in data_outputs:
- data_outputs["github_failed_only"] = report.print_failed_github_md(
- use_bc_ids=config.output_bc_ids)
- else:
data_outputs["github_failed_only"] += report.print_failed_github_md(use_bc_ids=config.output_bc_ids)
if "sarif" in config.output:
sarif_reports.append(report)
@@ -130,7 +127,6 @@ class RunnerRegistry:
exit_codes.append(report.get_exit_code(config.soft_fail, config.soft_fail_on, config.hard_fail_on))
if "cli" in config.output:
- data_outputs["cli"] = ''
for report in cli_reports:
data_outputs["cli"] += report.print_console(
is_quiet=config.quiet,
