From a4fb55e80cfd4700626ddea449d7a8fb42c1d4c6 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sat, 11 May 2013 14:48:00 -0400 Subject: [PATCH] Migrate to flake8. Closes bug 1172444 Change-Id: I4831946d01f05c2a10264745a07b53fa48be44c8 --- tools/flakes.py | 24 ------------------------ tools/test-requires | 8 ++++++-- tox.ini | 12 +++++++----- 3 files changed, 13 insertions(+), 31 deletions(-) delete mode 100644 tools/flakes.py diff --git a/tools/flakes.py b/tools/flakes.py deleted file mode 100644 index 191bd6eabc..0000000000 --- a/tools/flakes.py +++ /dev/null @@ -1,24 +0,0 @@ -""" - wrapper for pyflakes to ignore gettext based warning: - "undefined name '_'" - - Synced in from openstack-common -""" - -__all__ = ['main'] - -import __builtin__ as builtins -import sys - -import pyflakes.api -from pyflakes import checker - - -def main(): - checker.Checker.builtIns = (set(dir(builtins)) | - set(['_']) | - set(checker._MAGIC_GLOBALS)) - sys.exit(pyflakes.api.main()) - -if __name__ == "__main__": - main() diff --git a/tools/test-requires b/tools/test-requires index 52a181b8f4..936eb90c44 100644 --- a/tools/test-requires +++ b/tools/test-requires @@ -1,3 +1,9 @@ +# Install bounded pep8/pyflakes first, then let flake8 install +pep8==1.4.5 +pyflakes==0.7.2 +flake8==2.0 +hacking>=0.5.3,<0.6 + # Optional backend: SQL pysqlite @@ -14,8 +20,6 @@ nose # for test discovery and console feedback nosexcover openstack.nose_plugin nosehtmloutput -pylint # static code analysis -pep8==1.3.3 # checks for PEP8 code style compliance Sphinx>=1.1.2 # required to build documentation unittest2 # backport of unittest lib in python 2.7 webtest # test wsgi apps without starting an http server diff --git a/tox.ini b/tox.ini index d2669cce77..d9ada139f4 100644 --- a/tox.ini +++ b/tox.ini @@ -16,8 +16,8 @@ commands = nosetests {posargs} [testenv:pep8] commands = - pep8 --exclude=.venv,.tox,dist,doc,openstack,vendor,*egg --repeat --show-source . - pep8 --repeat --show-source --filename=keystone* bin + flake8 + flake8 --filename=keystone* bin [tox:jenkins] downloadcache = ~/cache/pip @@ -28,6 +28,8 @@ setenv = NOSE_WITH_COVERAGE=1 [testenv:venv] commands = {posargs} -[testenv:pyflakes] -deps = pyflakes -commands = python tools/flakes.py keystone +[flake8] +show-source = true +ignore = H,F841,F401,F403 +builtins = _ +exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,vendor