From 0a93b563e975e1815922852c2eacb32caa8faaf2 Mon Sep 17 00:00:00 2001 From: Rick Harris Date: Wed, 13 Feb 2013 23:33:20 +0000 Subject: Harmonize PEP8 checking between tox and run_tests.sh Tox and run_tests.sh were running PEP8 checks against different file-sets. This patch refactors the logic to determine which files to run PEP8 checks on into `tools/run_pep8.sh` where it can be called by both tox and `run_tests.sh`. Additional fixes: Some of our Python XenAPI Dom0 plugins don't end in *.py but should still be checked by PEP8. This patches fixes the hacking.py violations in the files and adds them back to the srcfiles list. Merged tools/unused_imports.sh into tools/run_pep8.sh Change-Id: Id5edd1acb644ab938beffc3473494a179d9d8cda --- tools/run_pep8.sh | 25 +++++++++++++++++++++++++ tools/unused_imports.sh | 4 ---- 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100755 tools/run_pep8.sh delete mode 100755 tools/unused_imports.sh (limited to 'tools') diff --git a/tools/run_pep8.sh b/tools/run_pep8.sh new file mode 100755 index 000000000..4e7212e08 --- /dev/null +++ b/tools/run_pep8.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# This is used by run_tests.sh and tox.ini +python tools/hacking.py --doctest + +# Until all these issues get fixed, ignore. +PEP8='python tools/hacking.py --ignore=E12,E711,E721,E712,N303,N403,N404' + +EXCLUDE='--exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*' +EXCLUDE+=',*egg,build,./plugins/xenserver/networking/etc/xensource/scripts' +EXCLUDE+=',./plugins/xenserver/xenapi/etc/xapi.d/plugins' +${PEP8} ${EXCLUDE} . + +${PEP8} --filename=nova* bin + +SCRIPT_ROOT=$(echo $(dirname $(readlink -f "$0")) | sed s/\\/tools//) + +SCRIPTS_PATH=${SCRIPT_ROOT}/plugins/xenserver/networking/etc/xensource/scripts +PYTHONPATH=${SCRIPTS_PATH} ${PEP8} ./plugins/xenserver/networking + +# NOTE(sirp): Also check Dom0 plugins w/o .py extension +PLUGINS_PATH=${SCRIPT_ROOT}/plugins/xenserver/xenapi/etc/xapi.d/plugins +PYTHONPATH=${PLUGINS_PATH} ${PEP8} ./plugins/xenserver/xenapi \ + `find plugins/xenserver/xenapi/etc/xapi.d/plugins/ -type f -perm +111` + +! pyflakes nova/ | grep "imported but unused" diff --git a/tools/unused_imports.sh b/tools/unused_imports.sh deleted file mode 100755 index 0e0294517..000000000 --- a/tools/unused_imports.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -#snakefood sfood-checker detects even more unused imports -! pyflakes nova/ | grep "imported but unused" -- cgit