(resultsPath: str, name: str, prefix: str, marker: str)
| 589 | |
| 590 | |
| 591 | def summaryReport(resultsPath: str, name: str, prefix: str, marker: str) -> str: |
| 592 | out = {} |
| 593 | outToday = {} |
| 594 | today = strDateTime()[:10] |
| 595 | |
| 596 | for filename in sorted(glob.glob(resultsPath + '/*')): |
| 597 | if not os.path.isfile(filename) or filename.endswith('.diff'): |
| 598 | continue |
| 599 | uploadedToday = False |
| 600 | firstLine = True |
| 601 | inResults = False |
| 602 | for line in open(filename, 'rt'): |
| 603 | if firstLine: |
| 604 | if line.startswith(today): |
| 605 | uploadedToday = True |
| 606 | firstLine = False |
| 607 | continue |
| 608 | line = line.strip() |
| 609 | if line.startswith('cppcheck: '): |
| 610 | if OLD_VERSION not in line: |
| 611 | # Package results seem to be too old, skip |
| 612 | break |
| 613 | # Current package, parse on |
| 614 | continue |
| 615 | if line.startswith(marker): |
| 616 | inResults = True |
| 617 | continue |
| 618 | if not inResults: |
| 619 | continue |
| 620 | if line.startswith('diff:'): |
| 621 | break |
| 622 | if not line.endswith(']'): |
| 623 | continue |
| 624 | if ': note: ' in line: |
| 625 | # notes normally do not contain message ids but can end with ']' |
| 626 | continue |
| 627 | message_id_start_pos = line.rfind('[') |
| 628 | if message_id_start_pos <= 0: |
| 629 | continue |
| 630 | messageId = line[message_id_start_pos+1:len(line)-1] |
| 631 | if ' ' in messageId: |
| 632 | # skip invalid messageIds |
| 633 | continue |
| 634 | |
| 635 | if messageId not in out: |
| 636 | out[messageId] = 0 |
| 637 | out[messageId] += 1 |
| 638 | if uploadedToday: |
| 639 | if messageId not in outToday: |
| 640 | outToday[messageId] = 0 |
| 641 | outToday[messageId] += 1 |
| 642 | |
| 643 | html = '<!DOCTYPE html>\n' |
| 644 | html += '<html><head><title>{} report</title></head><body>\n'.format(name) |
| 645 | html += '<h1>HEAD report</h1>\n' |
| 646 | html += '<h2>Uploaded today</h2>' |
| 647 | html += summaryReportFromDict(outToday, prefix, 'today') |
| 648 | html += '<h2>All</h2>' |
no test coverage detected