<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello<br>
<br>
I am working on an API extension that adds a parameter on create
server call; to implement the v2 API I added few lines of code to
nova/api/openstack/compute/servers.py<br>
<br>
In particular just adding something like <br>
<br>
<code>new_param = None</code><code><br>
</code><code>if self.ext_mgr.is_loaded('os-new-param'):</code><code><br>
</code><code> new_param = server_dict.get('new_param')</code><br>
<br>
leads to a pep8 fail with message 'Controller.create' is too complex
(47)<br>
(Note that in tox.ini the max complexity is fixed to 47 and there is
a note specifying 46 is the max complexity present at the moment).<br>
<br>
It is quite easy to make this test pass creating a new method just
to execute these lines of code, anyway all other extensions are
handled in that way and one of most important stylish rule states to
be consistent with surrounding code, so I don't think a separate
function is the way to go (unless it implies a change in how all
other extensions are handled too).<br>
<br>
My thoughts on this situation:<br>
<br>
1) New extensions should not consider v2 but only v2.1, so that file
should not be touched<br>
2) Ignore this error and go on: if and when the extension will be
merged the complexity in tox.ini will be changed too<br>
3) The complexity in tox.ini should be raised to allow new v2
extensions<br>
4) The code of that module should be refactored to lower the
complexity (i.e. move the load of each extension in a separate
function)<br>
<br>
I would like to know if any of my point is close to the correct
solution.<br>
<br>
<pre class="moz-signature" cols="72">--
Pasquale Porreca
DEK Technologies
Via dei Castelli Romani, 22
00040 Pomezia (Roma)
Mobile +39 3394823805
Skype paskporr</pre>
</body>
</html>