htmlreport: print the cppcheck version in the footer of the report

This commit is contained in:
Toralf Förster 2014-05-25 14:36:52 +02:00 committed by Daniel Marjamäki
parent 04f3caf8e8
commit 2d4bae0110
1 changed files with 5 additions and 2 deletions

View File

@ -127,7 +127,7 @@ HTML_FOOTER = """
</div> </div>
<div id="footer"> <div id="footer">
<p> <p>
Cppcheck - a tool for static C/C++ code analysis Cppcheck %s - a tool for static C/C++ code analysis
</p> </p>
<ul> <ul>
<li>Internet: <a href="http://cppcheck.sourceforge.net">http://cppcheck.sourceforge.net</a></li> <li>Internet: <a href="http://cppcheck.sourceforge.net">http://cppcheck.sourceforge.net</a></li>
@ -167,6 +167,7 @@ class CppCheckHandler(XmlContentHandler):
XmlContentHandler.__init__(self) XmlContentHandler.__init__(self)
self.errors = [] self.errors = []
self.version = '1' self.version = '1'
self.versionCppcheck = '';
def startElement(self, name, attributes): def startElement(self, name, attributes):
if name == 'results': if name == 'results':
@ -190,6 +191,8 @@ class CppCheckHandler(XmlContentHandler):
}) })
def handleVersion2(self, name, attributes): def handleVersion2(self, name, attributes):
if name == 'cppcheck':
self.versionCppcheck = attributes['version']
if name == 'error': if name == 'error':
self.errors.append({ self.errors.append({
'file': '', 'file': '',
@ -345,7 +348,7 @@ if __name__ == '__main__':
error['id'], error['severity'], error_class, error['id'], error['severity'], error_class,
error['msg'])) error['msg']))
output_file.write('</table>') output_file.write('</table>')
output_file.write(HTML_FOOTER) output_file.write(HTML_FOOTER % contentHandler.versionCppcheck)
print('Creating style.css file') print('Creating style.css file')
with io.open(os.path.join(options.report_dir, 'style.css'), with io.open(os.path.join(options.report_dir, 'style.css'),