2017-06-04 22:51:48 +02:00
|
|
|
#!/usr/bin/env python
|
2017-07-22 11:05:50 +02:00
|
|
|
from __future__ import print_function
|
2016-08-10 00:15:31 +02:00
|
|
|
import argparse
|
|
|
|
import xml.etree.ElementTree as ET
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
parser = argparse.ArgumentParser(description="List all error without a CWE assigned in CSV format")
|
2017-06-04 22:51:48 +02:00
|
|
|
parser.add_argument("-F", metavar="filename", required=True,
|
|
|
|
help="XML file containing output from: ./cppcheck --errorlist --xml-version=2")
|
2016-08-10 00:15:31 +02:00
|
|
|
parsed = parser.parse_args()
|
|
|
|
|
|
|
|
tree = ET.parse(vars(parsed)["F"])
|
|
|
|
root = tree.getroot()
|
|
|
|
for child in root.iter("error"):
|
|
|
|
if "cwe" not in child.attrib:
|
2017-07-22 11:05:50 +02:00
|
|
|
print(child.attrib["id"], child.attrib["severity"], child.attrib["verbose"], sep=", ")
|
2016-08-10 00:15:31 +02:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|