Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def print_reports(covdata, options, logger):
reports_were_written = False
default_output = OutputOrDefault(options.output)
generators = []
generators.append((
lambda: options.xml or options.prettyxml,
[options.xml],
print_xml_report,
lambda: logger.warn(
"Cobertura output skipped - "
"consider providing an output file with `--xml=OUTPUT`.")))
generators.append((
lambda: options.html or options.html_details,
[options.html, options.html_details],
print_html_report,
lambda: logger.warn(
GcovrConfigOption(
"prettyxml", ["--xml-pretty"],
group="output_options",
help="Pretty-print the XML report. Implies --xml. Default: {default!s}.",
action="store_true",
),
GcovrConfigOption(
"html", ["--html"],
group="output_options",
metavar='OUTPUT',
help="Generate a HTML report. "
"OUTPUT is optional and defaults to --output.",
nargs='?',
type=OutputOrDefault,
default=None,
const=OutputOrDefault(None),
),
GcovrConfigOption(
"html_details", ["--html-details"],
group="output_options",
metavar="OUTPUT",
help="Add annotated source code reports to the HTML report. "
"Implies --html. "
"OUTPUT is optional and defaults to --output.",
nargs='?',
type=OutputOrDefault,
default=None,
const=OutputOrDefault(None),
),
GcovrConfigOption(
"html_title", ["--html-title"],
group="output_options",
help="Generate a HTML report. "
"OUTPUT is optional and defaults to --output.",
nargs='?',
type=OutputOrDefault,
default=None,
const=OutputOrDefault(None),
),
GcovrConfigOption(
"html_details", ["--html-details"],
group="output_options",
metavar="OUTPUT",
help="Add annotated source code reports to the HTML report. "
"Implies --html. "
"OUTPUT is optional and defaults to --output.",
nargs='?',
type=OutputOrDefault,
default=None,
const=OutputOrDefault(None),
),
GcovrConfigOption(
"html_title", ["--html-title"],
group="output_options",
metavar="TITLE",
help="Use TITLE as title for the HTML report. Default is {default!s}.",
default="Head",
),
GcovrConfigOption(
"html_medium_threshold", ["--html-medium-threshold"],
group="output_options",
type=check_percentage,
metavar="MEDIUM",
help="If the coverage is below MEDIUM, the value is marked "
"OUTPUT is optional and defaults to --output.",
nargs='?',
type=OutputOrDefault,
default=None,
const=OutputOrDefault(None),
),
GcovrConfigOption(
"json", ["--json"],
group="output_options",
metavar='OUTPUT',
help="Generate a JSON report. "
"OUTPUT is optional and defaults to --output.",
nargs='?',
type=OutputOrDefault,
default=None,
const=OutputOrDefault(None),
),
GcovrConfigOption(
"prettyjson", ["--json-pretty"],
group="output_options",
help="Pretty-print the JSON report. Implies --json. Default: {default!s}.",
action="store_true",
),
GcovrConfigOption(
"filter", ["-f", "--filter"],
group="filter_options",
help="Keep only source files that match this filter. "
"Can be specified multiple times. "
"If no filters are provided, defaults to --root.",
action="append",
type=FilterOption,
default=[],