From 53adafb1f2c3a78ad8a6f99127398c83e52016e3 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Sat, 5 Oct 2013 12:20:25 +0200 Subject: [PATCH] Fixed htmlreport (#5068) --- htmlreport/cppcheck-htmlreport | 35 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/htmlreport/cppcheck-htmlreport b/htmlreport/cppcheck-htmlreport index 3037232b6..c35346943 100755 --- a/htmlreport/cppcheck-htmlreport +++ b/htmlreport/cppcheck-htmlreport @@ -172,26 +172,23 @@ class CppCheckHandler(XmlContentHandler): if name != "error": return - if attributes["id"] == "missingInclude": - self.errors.append( - { - "file" : "", - "line" : 0, - "id" : attributes["id"], - "severity" : attributes["severity"], - "msg" : attributes["msg"] - }) - else: - if attributes["file"] == "": + try: + file = attributes["file"] + line = int(attributes["line"]) + except: + file = "" + line = 0 + if attributes["id"] != "missingInclude" and attributes["id"] != "toomanyconfigs": sys.stderr.write("ERROR: cppcheck error reported without a file name.\n") - self.errors.append( - { - "file" : attributes["file"], - "line" : int(attributes["line"]), - "id" : attributes["id"], - "severity" : attributes["severity"], - "msg" : attributes["msg"] - }) + + self.errors.append( + { + "file" : file, + "line" : line, + "id" : attributes["id"], + "severity" : attributes["severity"], + "msg" : attributes["msg"] + }) if __name__ == '__main__': # Configure all the options this little utility is using.