From 7a4b0fb0e551ce043125bf2322a18b46a564d309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 7 Feb 2018 20:02:19 +0100 Subject: [PATCH] daca2-report: refactoring --- tools/daca2-report.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/tools/daca2-report.py b/tools/daca2-report.py index 1f4dca7f9..c471f34ba 100644 --- a/tools/daca2-report.py +++ b/tools/daca2-report.py @@ -30,6 +30,18 @@ def readdate(data): return None datepos += 1 +def summaryHtml(style, font, text1, text2, text3): + font1 = '' + font2 = '' + if font: + font1 = font + font2 = '' + return ' ' + + '' + font1 + text1 + font2 + ' ' + + '' + font1 + text2 + font2 + ' ' + + '' + font1 + text3 + font2 + ' ' + + '\n' + daca2folder = os.path.expanduser('~/daca2/') path = '' for arg in sys.argv[1:]: @@ -75,8 +87,8 @@ recent = [] totalNumber = {} categories = {} for severity in ['error', 'warning', 'style', 'portability', 'performance']: - totalNumber[severity] = 0 - categories[severity] = [] + totalNumber[severity] = 0 + categories[severity] = [] daca2 = daca2folder for lib in (False, True): @@ -158,12 +170,12 @@ mainpage.write('\n') mainpage.write('Summary\n') mainpage.write('\n') -mainpage.write('\n') -mainpage.write('\n') -mainpage.write('\n') -mainpage.write('\n') -mainpage.write('\n') -mainpage.write('\n') +mainpage.write(summaryHtml('style="background-color:#369"', '', 'Severity', 'Types', 'Amount')) +mainpage.write(summaryHtml('style="background-color:#fff"', None, 'Error (there is bug)', categories['error'], totalNumber['error'])) +mainpage.write(summaryHtml('style="background-color:#ccccff"', None, 'Warning (potential bug)', categories['warning'], totalNumber['warning'])) +mainpage.write(summaryHtml('style="background-color:#fff"', None, 'Style', categories['style'], totalNumber['style'])) +mainpage.write(summaryHtml('style="background-color:#ccccff"', None, 'Portability', categories['portability'], totalNumber['portability'])) +mainpage.write(summaryHtml('style="background-color:#fff"', None, 'Performance', categories['performance'], totalNumber['performance'])) mainpage.write('
SeverityTypesAmount
Error (there is bug)' + str(len(categories['error'])) + '' + str(totalNumber['error']) + '
Warning (potential bug)' + str(len(categories['warning'])) + '' + str(totalNumber['warning']) + '
Style' + str(len(categories['style'])) + '' + str(totalNumber['style']) + '
Portability' + str(len(categories['portability'])) + '' + str(totalNumber['portability']) + '
Performance' + str(len(categories['performance'])) + '' + str(totalNumber['performance']) + '
\n') if lastupdate: