def combine_report(args):
    if not os.path.exists(args.coverage_dir):
        raise Exception('Coverage directory %s does not exist.' %
                        args.coverage_dir)

    # Step 1: Read and combine intermediate reports
    combined = collections.defaultdict(lambda: collections.defaultdict(int))
    currentSource = None
    files = glob.glob(os.path.join(args.coverage_dir, '*.cvg'))

    for file in files:
        skip = False
        with open(file) as f:
            for line in f:
                if line[0] == 'F':
                    path = line[1:].strip()
                    currentSource = combined[path]
                    skip = args.skipCore and path.startswith('clients')
                elif not skip and line[0] == 'L':
                    lineNum, hit = [int(x) for x in line[1:].split()]
                    currentSource[lineNum] |= bool(hit)

    # Step 2: Calculate final aggregate and per-file coverage statistics
    stats = {
        'totalSloc': 0,
        'totalHits': 0,
        'files': {}
    }
    for file, lines in six.viewitems(combined):
        hits, sloc = 0, 0
        for lineNum, hit in six.viewitems(lines):
            sloc += 1
            hits += hit

        stats['totalSloc'] += sloc
        stats['totalHits'] += hits
        stats['files'][file] = {
            'sloc': sloc,
            'hits': hits
        }

    # Step 3: Generate the report
    report(args, combined, stats)
Combine all of the intermediate coverage files from each js test, and then
dataset/ETHPy150Open girder/girder/tests/js_coverage_tool.py/combine_report