[openstack-dev] [all] add cyclomatic complexity check to pep8 target

Steve Kowalik steven at wedontsleep.org
Fri Oct 17 04:36:11 UTC 2014


On 17/10/14 15:23, Angus Salkeld wrote:
> Thanks for that, I mostly copied your patch for Heat:
> https://review.openstack.org/#/c/129126/
> 
> I wish it would print out the value for all the modules tho', that is
> what is nice about radon.

It's a little horrible, but we can do the same thing:

(pep8)steven at undermined:~/openstack/openstack/heat% flake8
--max-complexity 0 | grep 'is too complex' | sort -k 2 -rn -t '(' | head
./heat/engine/stack.py:809:1: C901 'Stack.delete' is too complex (28)
./heat/tests/v1_1/fakes.py:240:1: C901
'FakeHTTPClient.post_servers_1234_action' is too complex (24)
./heat/engine/resources/server.py:738:1: C901 'Server.handle_update' is
too complex (23)
./doc/source/conf.py:62:1: C901 'write_autodoc_index' is too complex (18)
./heat/engine/stack.py:701:1: C901 'Stack.update_task' is too complex (17)
./heat/engine/resources/instance.py:709:1: C901 'Instance.handle_update'
is too complex (17)
./heat/engine/rsrc_defn.py:340:1: C901 'ResourceDefinition.__getitem__'
is too complex (16)
./heat/engine/resources/random_string.py:175:1: C901
'RandomString._generate_random_string' is too complex (16)
./heat/api/cfn/v1/stacks.py:277:1: C901
'StackController.create_or_update' is too complex (16)
./heat/engine/watchrule.py:358:1: C901 'rule_can_use_sample' is too
complex (15)

Cheers,
-- 
                                        Steve
Oh, in case you got covered in that Repulsion Gel, here's some advice
the lab boys gave me: [paper rustling] DO NOT get covered in the
Repulsion Gel.
         - Cave Johnson, CEO of Aperture Science



More information about the OpenStack-dev mailing list