[Pkg-debile-commits] [debile-slave] 64/100: add cppcheck
Sylvestre Ledru
sylvestre at alioth.debian.org
Mon Aug 19 14:53:10 UTC 2013
This is an automated email from the git hooks/post-receive script.
sylvestre pushed a commit to branch master
in repository debile-slave.
commit 17521e7b2f61b88d71b7eb90b6cc7478c3f91285
Author: Paul Tagliamonte <tag at pault.ag>
Date: Sun Jun 9 00:04:21 2013 -0400
add cppcheck
---
ethel/commands/__init__.py | 1 +
ethel/commands/cppcheck.py | 5 +++++
ethel/runners/cppcheck.py | 21 +++++++++++++++++++++
ethel/wrappers/cppcheck.py | 2 +-
4 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/ethel/commands/__init__.py b/ethel/commands/__init__.py
index 2c75564..4c700f5 100644
--- a/ethel/commands/__init__.py
+++ b/ethel/commands/__init__.py
@@ -5,6 +5,7 @@ PLUGINS = {
"build": "ethel.commands.build",
"pep8": "ethel.commands.pep8",
"perlcritic": "ethel.commands.perlcritic",
+ "cppcheck": "ethel.commands.cppcheck",
"lintian": "ethel.commands.lintian",
"lintian4py": "ethel.commands.lintian4py",
diff --git a/ethel/commands/cppcheck.py b/ethel/commands/cppcheck.py
new file mode 100644
index 0000000..2bd588b
--- /dev/null
+++ b/ethel/commands/cppcheck.py
@@ -0,0 +1,5 @@
+from ethel.runners.cppcheck import cppcheck
+
+
+def run(dsc, package, job, firehose):
+ return cppcheck(dsc, firehose)
diff --git a/ethel/runners/cppcheck.py b/ethel/runners/cppcheck.py
new file mode 100644
index 0000000..91f794b
--- /dev/null
+++ b/ethel/runners/cppcheck.py
@@ -0,0 +1,21 @@
+from ethel.wrappers.cppcheck import parse_cppcheck
+from ethel.utils import run_command, cd
+import os
+
+
+def cppcheck(dsc, analysis):
+ run_command(["dpkg-source", "-x", dsc, "source"])
+ with cd('source'):
+ out, err, ret = run_command([
+ 'cppcheck', '--enable=all', '.', '--xml'
+ ])
+
+ failed = False
+ for issue in parse_cppcheck(out.splitlines()):
+ analysis.results.append(issue)
+ if not failed and issue.severity in [
+ 'performance', 'portability', 'error', 'warning'
+ ]:
+ failed = True
+
+ return (analysis, out, failed)
diff --git a/ethel/wrappers/cppcheck.py b/ethel/wrappers/cppcheck.py
index c1bc5fc..6e6dda1 100644
--- a/ethel/wrappers/cppcheck.py
+++ b/ethel/wrappers/cppcheck.py
@@ -5,7 +5,7 @@ import lxml.etree
# cppcheck --enable=all . --xml 1>/dev/null ( stderr )
-def parse_cppcheck_xml(payload):
+def parse_cppcheck(payload):
tree = lxml.etree.fromstring(payload)
for result in tree.xpath("//results/error"):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-slave.git
More information about the Pkg-debile-commits
mailing list