Merge pull request #817 from boos/master

added python script to list in CSV format all errors without a CWE
This commit is contained in:
Daniel Marjamäki 2016-08-10 08:54:59 +02:00 committed by GitHub
commit 1204f35a70
1 changed files with 20 additions and 0 deletions

20
tools/listErrorsWithoutCWE.py Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/python
import argparse
import xml.etree.ElementTree as ET
def main():
parser = argparse.ArgumentParser(description="List all error without a CWE assigned in CSV format")
parser.add_argument("-F", metavar="filename", required=True, help="XML file containing output from: ./cppcheck --errorlist --xml-version=2")
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:
print child.attrib["id"], ",", child.attrib["severity"], ",", child.attrib["verbose"]
if __name__ == "__main__":
main()