Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 23 additions & 21 deletions htmlreport/cppcheck-htmlreport
Original file line number Diff line number Diff line change
Expand Up @@ -184,29 +184,31 @@ class CppCheckHandler(XmlContentHandler):
errors = []

def startElement(self, name, attributes):
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 name == "error":
if attributes["id"] == "missingInclude":
self.errors.append(
{
"file" : "",
"line" : 0,
"id" : attributes["id"],
"severity" : attributes["severity"],
"msg" : attributes["msg"]
})
else:
self.errors.append(
{
"file" : "",
"line" : 0,
"id" : attributes["id"],
"severity" : attributes["severity"],
"msg" : attributes["msg"]
})
elif name == "location":
if attributes["file"] == "":
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[-1]["file"] = attributes["file"]
self.errors[-1]["line"] = int(attributes["line"])


if __name__ == '__main__':
# Configure all the options this little utility is using.
Expand Down