]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Turn on Flake-8 Complexity Checking
authorJohn Griffith <john.griffith8@gmail.com>
Fri, 17 Oct 2014 04:43:20 +0000 (22:43 -0600)
committerJohn Griffith <john.griffith8@gmail.com>
Fri, 17 Oct 2014 19:53:31 +0000 (13:53 -0600)
Flake8 provides the ability to measure code complexity. There are
a lot of modules in Cinder that are considered "too complex", the
worst being "cinder/tests/test_huawei_hvs.py:110:1:" with a complexity
ranking of 59.

There's some outlyers at the higher end here, but the majority of the
code checks in at under 30, so let's make that our threshold and ignore
the two offenders that are above that for now.

Granted this may or may not be valuable, but it doesn't hurt to try it
and if we all hate it or find there's no value but it makes life difficult
we can always turn it back off.

See flake8.readthedocs for more info on flake8 and McCabe complexity
checking.

Change-Id: Icc1b5f2ccf0b630c1e655f5e6abf4e25ee30afc4

cinder/tests/test_huawei_hvs.py
cinder/tests/test_netapp.py
tox.ini

index 7ea5f76a99a4e0c76208bd0726b447ac8adb74c3..1c6f5162163fa28c1e3e6613a837a1b36d1440e1 100644 (file)
@@ -107,7 +107,7 @@ class FakeHVSCommon(rest_common.HVSCommon):
         # within this test.
         pass
 
-    def call(self, url=False, data=None, method=None):
+    def call(self, url=False, data=None, method=None):  # noqa
 
         url = url.replace('http://100.115.10.69:8082/deviceManager/rest', '')
         url = url.replace('/210235G7J20000000000/', '')
index ac4442df1dc902cfb9dce8d184f476cf48073019..c98141a365a9880133dc4c90874f36dac06550e0 100644 (file)
@@ -111,7 +111,7 @@ class FakeDirectCMODEServerHandler(FakeHTTPRequestHandler):
                   '<results reason="Not supported method type"'
                   ' status="failed" errno="Not_Allowed"/></netapp>')
 
-    def do_POST(s):
+    def do_POST(s):  # noqa
         """Respond to a POST request."""
         if '/servlets/netapp.servlets.admin.XMLrequest_filer' not in s.path:
             s.send_response(404)
diff --git a/tox.ini b/tox.ini
index 86bd6eaad813c37600ba1d2567cd290c54fa93da..3f08900432db2dd204a8bb5918c45d06a580df16 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -75,6 +75,7 @@ commands = {posargs}
 ignore = E251,E265,H302,H402,H405,H803,H904
 builtins = _
 exclude = .git,.venv,.tox,dist,tools,doc,common,*egg,build
+max-complexity=30
 
 [hacking]
 local-check-factory = cinder.hacking.checks.factory