From 3390cc30a62454b283cd6dc4f6448d0d12ae8101 Mon Sep 17 00:00:00 2001 From: Sam Lang Date: Thu, 31 Jan 2013 07:56:56 -0600 Subject: [PATCH] Scripts to use pyflakes to check python syntax. 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 Reviewed-by: Josh Durgin --- Makefile | 3 +++ check-syntax.sh | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 Makefile create mode 100755 check-syntax.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000..c7bf806e1608b --- /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 index 0000000000000..f63586f18f9ae --- /dev/null +++ b/check-syntax.sh @@ -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 -- 2.39.5