From fbc4568eb09bc2fe2d3d758758eb5e6a55c821ff Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Mon, 9 Jul 2012 16:03:14 -0700 Subject: Update tools hacking for pep8 1.2 and beyond * https://github.com/jcrocholl/pep8/commit/b9f72b16011aac981ce9e3a47fd0ffb1d3d2e085 broke tools/hacking.py * Upgrade pep8 to 1.2 and disable the following new tests: E12,E711,E712,E721,E502 Change-Id: I32a8808c6c9cccfedcc4d2a26649333aca1cd713 --- tools/hacking.py | 12 +++++++----- tools/test-requires | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/hacking.py b/tools/hacking.py index 096cf7786..1c2e11218 100755 --- a/tools/hacking.py +++ b/tools/hacking.py @@ -137,7 +137,7 @@ def nova_except_format(logical_line): N201 """ if logical_line.startswith("except:"): - return 6, "NOVA N201: no 'except:' at least use 'except Exception:'" + yield 6, "NOVA N201: no 'except:' at least use 'except Exception:'" def nova_except_format_assert(logical_line): @@ -148,7 +148,7 @@ def nova_except_format_assert(logical_line): N202 """ if logical_line.startswith("self.assertRaises(Exception"): - return 1, "NOVA N202: assertRaises Exception too broad" + yield 1, "NOVA N202: assertRaises Exception too broad" def nova_one_import_per_line(logical_line): @@ -166,7 +166,7 @@ def nova_one_import_per_line(logical_line): if (pos > -1 and (parts[0] == "import" or parts[0] == "from" and parts[2] == "import") and not is_import_exception(parts[1])): - return pos, "NOVA N301: one import per line" + yield pos, "NOVA N301: one import per line" _missingImport = set([]) @@ -241,7 +241,9 @@ def nova_import_module_only(logical_line): (len(split_line) == 2 or (len(split_line) == 4 and split_line[2] == "as"))): mod = split_line[1] - return importModuleCheck(mod) + rval = importModuleCheck(mod) + if rval != None: + yield rval # TODO(jogo) handle "from x import *" @@ -398,7 +400,7 @@ def nova_localization_strings(logical_line, tokens): map(gen.send, tokens) gen.close() except LocalizationError as e: - return e.args + yield e.args #TODO(jogo) Dict and list objects diff --git a/tools/test-requires b/tools/test-requires index 74910be0d..1931f313a 100644 --- a/tools/test-requires +++ b/tools/test-requires @@ -7,7 +7,7 @@ mox==0.5.3 nose openstack.nose_plugin>=0.7 nosehtmloutput -pep8==1.1 +pep8==1.2 pylint==0.25.2 sphinx>=1.1.2 feedparser -- cgit