diff --git a/htmlreport/cppcheck-htmlreport b/htmlreport/cppcheck-htmlreport index 2c8c32159..bd1d2f47e 100755 --- a/htmlreport/cppcheck-htmlreport +++ b/htmlreport/cppcheck-htmlreport @@ -328,7 +328,19 @@ class CppCheckHandler(XmlContentHandler): if name == 'cppcheck': self.versionCppcheck = attributes['version'] if name == 'error': - try: + # is there a better solution than this? + if (attributes.has_key('inconclusive') and attributes.has_key('cwe')): + self.errors.append({ + 'file': '', + 'line': 0, + 'id': attributes['id'], + 'severity': attributes['severity'], + 'msg': attributes['msg'], + 'verbose': attributes.get('verbose'), + 'inconclusive': attributes['inconclusive'], + 'cwe': attributes['cwe'] + }) + elif attributes.has_key('inconclusive'): self.errors.append({ 'file': '', 'line': 0, @@ -338,7 +350,17 @@ class CppCheckHandler(XmlContentHandler): 'verbose': attributes.get('verbose'), 'inconclusive': attributes['inconclusive'] }) - except KeyError: + elif attributes.has_key('cwe'): + self.errors.append({ + 'file': '', + 'line': 0, + 'id': attributes['id'], + 'severity': attributes['severity'], + 'msg': attributes['msg'], + 'verbose': attributes.get('verbose'), + 'cwe': attributes['cwe'] + }) + else: self.errors.append({ 'file': '', 'line': 0, @@ -531,8 +553,9 @@ if __name__ == '__main__': output_file.write('
\n' + ' ' + str(stats_count) + ' total
\n' + ''.join(stat_html) + '
Statistics
Line | Id | Severity | Message | |
---|---|---|---|---|
Line | Id | CWE | Severity | Message |
%s | ||||
%s | %s | %s | ||
%s | %s | %s | ||
%s | %s | %s | ||
%s | %s | %s | ||
%d | %s | %s | %s | |
%d | %s | %s | %s | %s |
%d | %s | %s | %s |