[Kimchi-devel] [PATCH] run pyflakes when make check

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Mon Mar 24 14:58:00 UTC 2014


From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

Pyflakes analyzes programs and detects various errors. It works by
parsing the source file, not importing it, so it is safe to use on
modules with side effects. It's also much faster.

This is important to improve the code quality.

Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
Signed-off-by: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
---
 Makefile.am  | 7 +++++++
 configure.ac | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 2fdafb1..c68f050 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -71,7 +71,14 @@ PEP8_WHITELIST = \
 	tests/utils.py \
 	$(NULL)
 
+SKIP_PYFLAKES_ERR = "\./src/kimchi/websocket\.py"
+
 check-local:
+	find . -path './.git' -prune -type f -o \
+		-name '*.py' -o -name '*.py.in'  | xargs $(PYFLAKES) | \
+		grep -w -v $(SKIP_PYFLAKES_ERR) | \
+		while read LINE; do echo "$$LINE"; false; done
+
 	$(PEP8) --version
 	$(PEP8) --filename '*.py,*.py.in' $(PEP8_WHITELIST)
 
diff --git a/configure.ac b/configure.ac
index 365348f..a625f35 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,6 +42,13 @@ AM_GNU_GETTEXT([external])
 AM_GNU_GETTEXT_VERSION([0.10])
 AC_PATH_PROG([CHEETAH], [cheetah], [/usr/bin/cheetah])
 
+# Checking for pyflakes
+AC_PATH_PROG([PYFLAKES], [pyflakes])
+if test "x$PYFLAKES" = "x"; then
+  AC_MSG_WARN([pyflakes not found])
+fi
+
+
 AC_CONFIG_FILES([
     po/Makefile.in
     po/gen-pot
-- 
1.8.5.3




More information about the Kimchi-devel mailing list