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
This commit is contained in:
Joe Gordon
2012-07-09 16:03:14 -07:00
parent d399c75568
commit fbc4568eb0
3 changed files with 10 additions and 8 deletions
+7 -5
View File
@@ -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
+1 -1
View File
@@ -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
+2 -2
View File
@@ -22,9 +22,9 @@ sitepackages = True
downloadcache = ~/cache/pip
[testenv:pep8]
deps=pep8==1.0.1
deps=pep8==1.2
commands =
python tools/hacking.py --ignore=N4 --repeat --show-source \
python tools/hacking.py --ignore=N4,E12,E711,E712,E721,E502 --repeat --show-source \
--exclude=.venv,.tox,dist,doc,*openstack/common*,*lib/python*,*egg .
[testenv:pylint]