Showing 133 of 222 total issues
Function _get_snapshot
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _get_snapshot(clone_params, template):
snapshot_name = getattr(clone_params, 'snapshot', None)
if not snapshot_name:
return None
- 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 convert_to_resource_model
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def convert_to_resource_model(self, attributes, resource_model_type):
"""
Converts an instance of resource with dictionary of attributes
to a class instance according to family and assigns its properties
:type attributes: dict
- 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 main
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def main():
try:
si = None
try:
- 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 __init__
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, pv_service, vcenter_data_model, si, logger, deployer, reservation_id,
Function factory
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def factory(saveDeploymentModel, pv_service, vcenter_data_model, si, logger, deployer, reservation_id,
Function clone_vm
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def clone_vm(self, clone_params, logger, cancellation_context):
"""
Clone a VM from a template/VM and return the vm oject or throws argument is not valid
:param cancellation_context:
- 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 parse_vlan_id
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def parse_vlan_id(vlan_type, vlan_id):
if not vlan_type or not vlan_id:
raise ValueError('vlan_id is empty')
if vlan_type == 'Access':
- 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 wait_for_task
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def wait_for_task(self, task, logger, action_name='job', hide_result=False, cancellation_context=None):
"""
Waits and provides updates on a vSphere task
:param cancellation_context: package.cloudshell.cp.vcenter.models.QualiDriverModels.CancellationContext
:param task:
- 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 __init__
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, id, name, fullname, type, address, model, family, description, attributes, appdata_json,
Function _get_ip_addresses
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _get_ip_addresses(vm, default_network):
ips = []
if vm.guest.ipAddress:
ips.append(vm.guest.ipAddress)
for nic in vm.guest.net:
- 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 a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. 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 __init__
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, source, target, target_family, target_model, target_type, target_attributes, direction, alias,
Function power_off
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def power_off(self, si, logger, session, vcenter_data_model, vm_uuid, resource_fullname):
"""
Power off of a vm
:param vcenter_data_model: vcenter model
:param si: Service Instance
- 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
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 get_obj
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_obj(self, content, vimtypes, name):
"""
Return an object by name for a specific type, if name is None the
first found object is returned
- 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 __init__
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self):
"""
Initialize the driver session, this function is called everytime a new instance of the driver is created
in here the driver is going to be bootstrapped
Function _deploy_a_clone
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def _deploy_a_clone(self, si, logger, app_name, template_name, other_params, vcenter_data_model, reservation_id,
Function create_from_params
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_from_params(cls, template_model, datastore_name, vm_cluster_model, ip_regex, refresh_ip_timeout,
Function execute_deploy_from_image
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def execute_deploy_from_image(self, si, logger, session, vcenter_data_model, reservation_id, deployment_params,
Function __init__
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,