diff options
| author | Rick Harris <rconradharris@gmail.com> | 2013-02-13 23:33:20 +0000 |
|---|---|---|
| committer | Rick Harris <rconradharris@gmail.com> | 2013-02-15 00:39:58 +0000 |
| commit | 0a93b563e975e1815922852c2eacb32caa8faaf2 (patch) | |
| tree | fed241e98b072f270bf79d4b8fb19695f1e31ea8 /tools | |
| parent | 4ffddcfa6385703ce9a02f624999f05b388778e6 (diff) | |
| download | nova-0a93b563e975e1815922852c2eacb32caa8faaf2.tar.gz nova-0a93b563e975e1815922852c2eacb32caa8faaf2.tar.xz nova-0a93b563e975e1815922852c2eacb32caa8faaf2.zip | |
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
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/run_pep8.sh | 25 | ||||
| -rwxr-xr-x | tools/unused_imports.sh | 4 |
2 files changed, 25 insertions, 4 deletions
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" |
