MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / generate_package_diff_statistics

Function generate_package_diff_statistics

tools/donate-cpu-server.py:456–492  ·  view source on GitHub ↗
(filename: str)

Source from the content-addressed store, hash-verified

454
455
456def generate_package_diff_statistics(filename: str) -> None:
457 is_diff = False
458
459 sums = {}
460
461 for line in open(filename, 'rt'):
462 line = line.strip()
463 if line == 'diff:':
464 is_diff = True
465 continue
466 if not is_diff:
467 continue
468 if not line.endswith(']'):
469 continue
470
471 if line.startswith(OLD_VERSION + ' '):
472 version = OLD_VERSION
473 elif line.startswith('head '):
474 version = 'head'
475 else:
476 continue
477
478 messageId = line[line.rfind('[')+1:len(line)-1]
479
480 if messageId not in sums:
481 sums[messageId] = {OLD_VERSION: 0, 'head': 0}
482
483 sums[messageId][version] += 1
484
485 output = {'date': strDateTime()[:10], 'sums': sums}
486
487 filename_diff = filename + '.diff'
488 if sums:
489 with open(filename_diff, 'wt') as f:
490 f.write(json.dumps(output))
491 elif os.path.isfile(filename_diff):
492 os.remove(filename_diff)
493
494
495def diffMessageIdReport(resultPath: str, messageId: str) -> str:

Callers 1

serverFunction · 0.85

Calls 2

strDateTimeFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected