triage-report.py: use classifications 'true positive', 'false positive', 'false negative' instead

This commit is contained in:
Daniel Marjamäki 2015-01-07 21:12:09 +01:00
parent af8961d56b
commit 2b018db25a
1 changed files with 11 additions and 7 deletions

View File

@ -24,12 +24,13 @@ fin.close()
out = {}
out['untriaged'] = ''
out['fn'] = ''
out['fp'] = ''
out['tp'] = ''
out['notfound'] = ''
numberOfFalsePositives = 0
numberOfTruePositives = 0
numberOfFalseNegatives = 0
for result in results.split('\n'):
result = result.strip()
@ -45,11 +46,11 @@ for result in results.split('\n'):
classification = 'Untriaged'
if result in truepositives:
css = 'tp'
classification = 'Bug'
classification = 'True Positive'
numberOfTruePositives += 1
elif result in falsepositives:
css = 'fp'
classification = 'Not bug'
classification = 'False Positive'
numberOfFalsePositives += 1
href = None
@ -80,11 +81,13 @@ for line in f.readlines():
if line in results:
continue
numberOfFalseNegatives += 1
filename = res.group(1)
linenr = res.group(2)
message = res.group(3)
classification = 'Not Found'
css = 'notfound'
classification = 'False Negative'
css = 'fn'
html = ' <tr>'
html += '<td class='+css+'>'+filename+'</td>'
@ -106,14 +109,15 @@ else:
fout = open('report.html','wt')
fout.write('<html><head><title>Cppcheck results for ' + project + '</title><link rel="stylesheet" type="text/css" href="theme1.css"></head><body>\n')
fout.write('<h1>Cppcheck results for ' + project + '</h1>\n')
fout.write('<p>Number of false negatives: ' + str(numberOfFalseNegatives) + '</p>\n')
fout.write('<p>Number of true positives: ' + str(numberOfTruePositives) + '</p>\n')
fout.write('<p>Number of false positives: ' + str(numberOfFalsePositives) + '</p>\n')
fout.write('<table border="0">\n')
fout.write('<tr><th>Filename</th><th>Line</th><th>Message</th><th>Classification</th></tr>\n')
fout.write(out['fn'])
fout.write(out['tp'])
fout.write(out['notfound'])
fout.write(out['untriaged'])
fout.write(out['fp'])
fout.write(out['untriaged'])
fout.write('</table></body></html>')
fout.close()