1 Add support for cppcheck lint checking.
3 diff -r 9a4f617d6a04 bitten/build/ctools.py
4 --- a/bitten/build/ctools.py Mon Nov 30 16:38:38 2009 +0100
5 +++ b/bitten/build/ctools.py Wed Dec 02 13:18:05 2009 +0100
8 log.warning('Error parsing CppUnit results file (%s)', e)
10 +def cppcheck (ctxt, file_=None):
11 + """Collect Cppcheck XML data.
13 + :param: ctxt: the build context
14 + :type ctxt: `Context`
15 + :param file\_: path of the file containing the Cppcheck results.
17 + assert file_, 'Missing required attribute "file"'
20 + fileobj = file(ctxt.resolve(file_), 'r')
22 + results = xmlio.Fragment()
23 + log_elem = xmlio.Fragment()
26 + log_elem.append (xmlio.Element ('message', level='info')[msg])
27 + info ("Analyzing cppcheck results...")
28 + categories = { "error": "error", "possible error": "warning",
29 + "style": "convention", "possible style": "convention" }
30 + for node in xmlio.parse(fileobj):
31 + if node.name != 'error':
36 + category = categories.get (node.attr["severity"], "error"),
37 + type = node.attr["id"],
38 + line = node.attr["line"],
39 + file = node.attr["file"])
41 + info ("%s (%s): (%s) %s"
42 + % (node.attr["file"],
44 + node.attr["severity"],
46 + ctxt.report ('lint', results)
51 + log.warning('Error opening Cppcheck results file (%s)', e)
52 + except xmlio.ParseError, e:
53 + log.warning('Error parsing Cppcheck results file (%s)', e)
56 def cunit (ctxt, file_=None, srcdir=None):
57 """Collect CUnit XML data.
59 diff -r 9a4f617d6a04 setup.py
60 --- a/setup.py Mon Nov 30 16:38:38 2009 +0100
61 +++ b/setup.py Wed Dec 02 13:18:05 2009 +0100
63 'c#autoreconf = bitten.build.ctools:autoreconf',
64 'c#cppunit = bitten.build.ctools:cppunit',
65 'c#cunit = bitten.build.ctools:cunit',
66 + 'c#cppcheck = bitten.build.ctools:cppcheck',
67 'c#gcov = bitten.build.ctools:gcov',
68 'c#make = bitten.build.ctools:make',
69 'mono#nunit = bitten.build.monotools:nunit',