Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return
if excluded:
logger.verbose_msg(" Excluding coverage data for file {}", fname)
return
key = os.path.normpath(fname)
parser = GcovParser(key, logger=logger)
parser.parse_all_lines(
INPUT,
exclude_unreachable_branches=options.exclude_unreachable_branches,
exclude_throw_branches=options.exclude_throw_branches,
ignore_parse_errors=options.gcov_ignore_parse_errors)
covdata.setdefault(key, FileCoverage(key)).update(parser.coverage)
INPUT.close()
def _split_coverage_results(covdata, coverages):
for coverage in coverages.values():
if coverage.filename not in covdata:
covdata[coverage.filename] = FileCoverage(coverage.filename)
covdata[coverage.filename].update(coverage)
def __init__(self, fname, logger):
self.logger = logger
self.excluding = []
self.coverage = FileCoverage(fname)
# self.first_record = True
self.fname = fname
self.lineno = 0
self.last_code_line = ""
self.last_code_lineno = 0
self.last_code_line_excluded = False
self.unrecognized_lines = []
self.deferred_exceptions = []
self.last_was_specialization_section_marker = False
logger = Logger(options.verbose)
for filename in filenames:
gcovr_json_data = {}
logger.verbose_msg("Processing JSON file: {}", filename)
with open(filename, 'r') as json_file:
gcovr_json_data = json.load(json_file)
assert gcovr_json_data['gcovr/format_version'] == JSON_FORMAT_VERSION
coverage = {}
for gcovr_file in gcovr_json_data['files']:
file_path = os.path.join(os.path.abspath(options.root), gcovr_file['file'])
file_coverage = FileCoverage(file_path)
_lines_from_json(file_coverage, gcovr_file['lines'])
coverage[file_path] = file_coverage
_split_coverage_results(covdata, coverage)