]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Pin pep8 1.3.3
authorChuck Short <chuck.short@canonical.com>
Tue, 20 Nov 2012 15:05:57 +0000 (09:05 -0600)
committerChuck Short <chuck.short@canonical.com>
Tue, 20 Nov 2012 15:10:01 +0000 (09:10 -0600)
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>
cinder/tests/api/openstack/volume/test_extensions.py
cinder/tests/api/openstack/volume/test_router.py
run_tests.sh
tools/hacking.py
tools/test-requires
tox.ini

index 72749ce4c5d2b83c1bdbc2ec88dc8fed90fceb6b..e1e9748bec899d9d26bf629a2a9d294a4c33ea1c 100644 (file)
 #    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
index 6be12e14d074b9ba9a314fcdbd3f48350ad0c85d..eba2388c0040180176ef707dbe5a32ce81e9eac9 100644 (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
index e1ea0855a25c2d92cc45342583f95d39eef1ee7e..63d6189cb0cb14954bba0c7b3d00f8bae802bfef 100755 (executable)
@@ -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}
 }
 
index 545157bd64415a647b7436d0b5887a29319118da..8d20189ed5b5a25fa54e41f2665e5278cc313413 100755 (executable)
@@ -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
 
index 7e7f3246e42da77f75f6c6da4d31377e6b113f87..9f78c1a307ead73bf6788bbd2c2bccbc9e2b7f29 100644 (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
diff --git a/tox.ini b/tox.ini
index afb9d3317e61660a6b0627a628e99909a6b3e99e..47a65cce73cb9dc94812860e78b9043ae67511b0 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -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]