Pin pep8 1.3.3

Apart of making pep8 version standard across all openstack
projects.

Also fix tools/hacking.py so it is compliant for pep8 1.2
and beyond, taken from fbc4568 in the nova tree.

Change-Id: I801c98a01960fa113dae1b6174c1a06bb149fea3
Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
Chuck Short 2012-11-20 09:05:57 -06:00
parent 55c09da1b0
commit ceee1fdaf2
6 changed files with 15 additions and 14 deletions

View File

@ -16,10 +16,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import webob
from lxml import etree
import iso8601
from lxml import etree
import webob
from cinder.api.openstack import volume
from cinder.api.openstack import xmlutil

View File

@ -16,8 +16,8 @@
from cinder.api.openstack import volume
from cinder.api.openstack.volume import snapshots
from cinder.api.openstack.volume import volumes
from cinder.api.openstack.volume import versions
from cinder.api.openstack.volume import volumes
from cinder.api.openstack import wsgi
from cinder import flags
from cinder.openstack.common import log as logging

View File

@ -116,7 +116,7 @@ function run_pep8 {
#
# Until all these issues get fixed, ignore.
ignore='--ignore=N4,N306'
ignore='--ignore=N4,E12,E711,E712,E721,E502'
${wrapper} python tools/hacking.py ${ignore} ${srcfiles}
}

View File

@ -88,7 +88,7 @@ def cinder_except_format(logical_line):
N201
"""
if logical_line.startswith("except:"):
return 6, "CINDER N201: no 'except:' at least use 'except Exception:'"
yield 6, "CINDER N201: no 'except:' at least use 'except Exception:'"
def cinder_except_format_assert(logical_line):
@ -99,7 +99,7 @@ def cinder_except_format_assert(logical_line):
N202
"""
if logical_line.startswith("self.assertRaises(Exception"):
return 1, "CINDER N202: assertRaises Exception too broad"
yield 1, "CINDER N202: assertRaises Exception too broad"
def cinder_one_import_per_line(logical_line):
@ -117,7 +117,7 @@ def cinder_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, "CINDER N301: one import per line"
yield pos, "CINDER N301: one import per line"
_missingImport = set([])
@ -191,7 +191,9 @@ def cinder_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 *"
@ -348,7 +350,7 @@ def cinder_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

View File

@ -7,7 +7,7 @@ nose
nosexcover
openstack.nose_plugin
nosehtmloutput
pep8==1.1
pep8==1.3.3
pylint==0.25.2
sphinx>=1.1.2
MySQL-python

View File

@ -13,11 +13,11 @@ deps = -r{toxinidir}/tools/pip-requires
commands = /bin/bash run_tests.sh -N -P {posargs}
[testenv:pep8]
deps = pep8==1.1
deps = pep8==1.3.3
commands =
python tools/hacking.py --ignore=N4,E12,E711,E721 --repeat --show-source \
python tools/hacking.py --ignore=N4,E12,E711,E712,E721,E502 --repeat --show-source \
--exclude=.venv,.tox,dist,doc,openstack,*egg .
python tools/hacking.py --ignore=N4,E12,E711,E721 --repeat --show-source \
python tools/hacking.py --ignore=N4,E12,E711,E712,E721,E502 --repeat --show-source \
--filename=cinder* bin
[testenv:venv]