From 6bc7e271b5012485a26a75cabf2bfee2fb210b28 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Wed, 18 Mar 2015 01:58:30 -0700 Subject: [PATCH] Tox: reduce complexity level to 35 The max-complexity is now set at 35. We are unable to lower this due to the following offenders: ./nova/virt/xenapi/vmops.py:431:1: C901 'VMOps._spawn' is too complex (34) ./nova/network/manager.py:1226:1: C901 'NetworkManager._do_create_networks' is too complex (34) ./nova/network/neutronv2/api.py:370:1: C901 'API.allocate_for_instance' is too complex (34) Change-Id: I6101dcb594b88d346edd72eea2ef2250c4e2891f --- nova/tests/unit/virt/vmwareapi/fake.py | 17 ++++++----------- tox.ini | 4 ++-- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/nova/tests/unit/virt/vmwareapi/fake.py b/nova/tests/unit/virt/vmwareapi/fake.py index f876a8de87c1..96d1487e969f 100644 --- a/nova/tests/unit/virt/vmwareapi/fake.py +++ b/nova/tests/unit/virt/vmwareapi/fake.py @@ -1585,18 +1585,13 @@ class FakeVim(object): elif attr_name == "AddPortGroup": return lambda *args, **kwargs: self._add_port_group(attr_name, *args, **kwargs) - elif attr_name == "RebootHost_Task": - return lambda *args, **kwargs: self._just_return_task(attr_name) - elif attr_name == "ShutdownHost_Task": - return lambda *args, **kwargs: self._just_return_task(attr_name) - elif attr_name == "PowerUpHostFromStandBy_Task": - return lambda *args, **kwargs: self._just_return_task(attr_name) - elif attr_name == "EnterMaintenanceMode_Task": - return lambda *args, **kwargs: self._just_return_task(attr_name) - elif attr_name == "ExitMaintenanceMode_Task": + elif attr_name in ("RebootHost_Task", + "ShutdownHost_Task", + "PowerUpHostFromStandBy_Task", + "EnterMaintenanceMode_Task", + "ExitMaintenanceMode_Task", + "RescanHba"): return lambda *args, **kwargs: self._just_return_task(attr_name) elif attr_name == "AddInternetScsiSendTargets": return lambda *args, **kwargs: self._add_iscsi_send_tgt(attr_name, *args, **kwargs) - elif attr_name == "RescanHba": - return lambda *args, **kwargs: self._just_return_task(attr_name) diff --git a/tox.ini b/tox.ini index 2d55411706b9..08ddeb3cb7a2 100644 --- a/tox.ini +++ b/tox.ini @@ -75,9 +75,9 @@ ignore = E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E251,H405 exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools/xenserver* # To get a list of functions that are more complex than 25, set max-complexity # to 25 and run 'tox -epep8'. -# 37 is currently the most complex thing we have +# 34 is currently the most complex thing we have # TODO(jogo): get this number down to 25 or so -max-complexity=38 +max-complexity=35 [hacking] local-check-factory = nova.hacking.checks.factory