daca2-report: Write a summary at the bottom

This commit is contained in:
Daniel Marjamäki 2018-02-07 15:38:07 +01:00
parent dccf96cb7b
commit 21c7bc9291
1 changed files with 35 additions and 1 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import os import os
import sys import sys
import re
def readdate(data): def readdate(data):
if data[:5] == 'DATE ': if data[:5] == 'DATE ':
@ -72,6 +72,12 @@ mainpage.write(
lastupdate = None lastupdate = None
recent = [] recent = []
totalNumber = {}
categories = {}
for severity in ['error', 'warning', 'style', 'portability', 'performance']:
totalNumber[severity] = 0
categories[severity] = []
daca2 = daca2folder daca2 = daca2folder
for lib in (False, True): for lib in (False, True):
for a in "0123456789abcdefghijklmnopqrstuvwxyz": for a in "0123456789abcdefghijklmnopqrstuvwxyz":
@ -98,6 +104,24 @@ for lib in (False, True):
else: else:
datestr = '' datestr = ''
for line in data.split('\n'):
res = re.match(r'.*: (error|warning|style|performance|style|portability):.* \[([a-zA-Z0-9_\\-]+)\]', line)
if res is None:
continue
severity = res.group(1)
messageId = res.group(2)
if messageId == 'cppcheckError':
continue
if messageId == 'internalAstError':
continue
if messageId == 'preprocessorErrorDirective':
continue
if messageId == 'syntaxError':
continue
totalNumber[severity] = totalNumber[severity] + 1
if not messageId in categories[severity]:
categories[severity].append(messageId)
mainpage.write( mainpage.write(
'<tr>' + '<tr>' +
'<td><a href="daca2-' + a + '.html">' + a + '</a></td>' + '<td><a href="daca2-' + a + '.html">' + a + '</a></td>' +
@ -132,6 +156,16 @@ for lib in (False, True):
mainpage.write('</table>\n') mainpage.write('</table>\n')
mainpage.write('<b>Summary</b>\n')
mainpage.write('<table>\n')
mainpage.write('<tr><td>Severity</td><td>Types</td><td>Amount</td>\n')
mainpage.write('<tr><td>Error (there is bug)</td><td>' + str(len(categories['error'])) + '</td><td>' + str(totalNumber['error']) + '</td></tr>\n')
mainpage.write('<tr><td>Warning (potential bug)</td><td>' + str(len(categories['warning'])) + '</td><td>' + str(totalNumber['warning']) + '</td></tr>\n')
mainpage.write('<tr><td>Style</td><td>' + str(len(categories['style'])) + '</td><td>' + str(totalNumber['style']) + '</td></tr>\n')
mainpage.write('<tr><td>Portability</td><td>' + str(len(categories['portability'])) + '</td><td>' + str(totalNumber['portability']) + '</td></tr>\n')
mainpage.write('<tr><td>Performance</td><td>' + str(len(categories['performance'])) + '</td><td>' + str(totalNumber['performance']) + '</td></tr>\n')
mainpage.write('</table>\n')
if lastupdate: if lastupdate:
mainpage.write('<p>Last update: ' + lastupdate + '</p>') mainpage.write('<p>Last update: ' + lastupdate + '</p>')
allrecent = '' allrecent = ''