]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Scripts to use pyflakes to check python syntax.
authorSam Lang <sam.lang@inktank.com>
Thu, 31 Jan 2013 13:56:56 +0000 (07:56 -0600)
committerSam Lang <sam.lang@inktank.com>
Thu, 31 Jan 2013 13:56:56 +0000 (07:56 -0600)
pyflakes runs a basic syntax checker against python code.
The added check-syntax.sh script and Makefile run pyflakes
on the python code within the teuthology directory reporting
any syntax errors that are found.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Makefile [new file with mode: 0644]
check-syntax.sh [new file with mode: 0755]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..c7bf806
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,3 @@
+
+all:
+       @./check-syntax.sh
diff --git a/check-syntax.sh b/check-syntax.sh
new file mode 100755 (executable)
index 0000000..f63586f
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+which pyflakes > /dev/null
+if test $? != 0; then
+    echo "$0 requires pyflakes (sudo apt-get install pyflakes)"
+    exit 1
+fi
+
+d=$(dirname $0)
+for f in $(find ${d}/teuthology | grep py$); do
+    if test -n "${V}"; then
+       echo "checking ${f}"
+    fi
+    pyflakes ${f} > >( \
+       grep -v "'Lock' imported but unused" | \
+       grep -v "'MachineLock' imported but unused" \
+       )
+done