package/cloudshell/cp/vcenter/vm/vnic_to_network_mapper.py
Function map_request_to_vnics
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def map_request_to_vnics(self, requests, vnics, existing_network, default_network, reserved_networks):
"""
gets the requests for connecting netwoks and maps it the suitable vnic of specific is not specified
:param reserved_networks: array of reserved networks
:param requests:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _map_vnic_to_network
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def _map_vnic_to_network(self, vnics, existing_network, default_network, reserved_networks):
mapping = dict()
for vnic_name, vnic in vnics.items():
network_to_map = ''
if hasattr(vnic, 'backing'):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function map_request_to_vnics
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def map_request_to_vnics(self, requests, vnics, existing_network, default_network, reserved_networks):