Showing 133 of 222 total issues
File vmomi_service.py
has 613 lines of code (exceeds 250 allowed). Consider refactoring. Open
import time
import requests
from pyVmomi import vim
File command_orchestrator.py
has 469 lines of code (exceeds 250 allowed). Consider refactoring. Open
import time
from datetime import datetime
import jsonpickle
from cloudshell.cp.vcenter.commands.vm_details import VmDetailsCommand
pyVmomiService
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
class pyVmomiService:
# region consts
ChildEntity = 'childEntity'
VM = 'vmFolder'
Network = 'networkFolder'
File connect_orchestrator.py
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
import traceback
from multiprocessing.pool import ThreadPool
import jsonpickle
ConnectionCommandOrchestrator
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
class ConnectionCommandOrchestrator(object):
def __init__(self, connector, disconnector, resource_model_parser):
"""
:param connector:
Function get_folder
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def get_folder(self, si, path, root=None):
"""
Finds folder in the vCenter or returns "None"
:param si: pyvmomi 'ServiceInstance'
- 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
VCenterAutoModelDiscovery
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class VCenterAutoModelDiscovery(object):
def __init__(self):
self.dc = None
self.parser = ResourceModelParser()
self.pv_service = pyVmomiService(SmartConnect, Disconnect, SynchronousTaskWaiter())
File model_auto_discovery.py
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
import collections
from pyVim.connect import SmartConnect, Disconnect
from pyVmomi import vim
VCenterShellDriver
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class VCenterShellDriver(ResourceDriverInterface):
def cleanup(self):
pass
def __init__(self):
CommandOrchestrator
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class CommandOrchestrator(object):
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 is_vnic_attached_to_one_of_these_networks
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def is_vnic_attached_to_one_of_these_networks(device, networks):
for network in networks:
if hasattr(device, 'backing'):
found = False
if hasattr(device.backing, 'port') and hasattr(device.backing.port, 'portgroupKey'):
- 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
LinkedCloneArtifactHandler
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class LinkedCloneArtifactHandler(object):
def __init__(self, pv_service, vcenter_data_model, si, logger, deployer, reservation_id,
resource_model_parser, snapshot_saver, task_waiter, folder_manager, port_configurer,
cancellation_service):
self.SNAPSHOT_NAME = 'artifact'
File vnic_service.py
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from pyVmomi import vim
from cloudshell.cp.vcenter.common.vcenter.vmomi_service import pyVmomiService
from cloudshell.cp.vcenter.network.network_specifications import network_is_standard, network_is_portgroup
Function erase_network_by_mapping
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def erase_network_by_mapping(self, networks, reserved_networks, logger):
nets = dict()
self._lock.acquire()
try:
for net in networks:
- 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
VNicService
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class VNicService(object):
def __init__(self):
super(VNicService, self).__init__()
@staticmethod
Function wait_for_task
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def wait_for_task(task, raiseOnError=True, si=None, pc=None):
if si is None:
si = GetSi()
if pc is 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 get_ip
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_ip(self, vm, default_network, match_function, cancellation_context, timeout, logger):
self._validate_vmware_tools_installed(logger, vm)
ip = None
reason = IpReason.Success
if not timeout:
- 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 _find_resource_pool
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _find_resource_pool(self, name, root):
if hasattr(root, 'resourcePool'):
resource_pool = root.resourcePool
if hasattr(resource_pool, 'name') and resource_pool.name == name:
return resource_pool
- 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_vlan_id_to_str
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _convert_vlan_id_to_str(vlan_id):
if vlan_id:
if isinstance(vlan_id, list):
return ','.join([VmDetailsProvider._convert_vlan_id_to_str(v) for v in vlan_id if v])
- 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 _remove_vlan
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _remove_vlan(self, action_mappings, si, vm_uuid, logger):
final_res = []
mode_to_actions = action_mappings.action_tree[ACTION_TYPE_REMOVE_VLAN]
try:
self.logger.info('disconnecting vm({0})'.format(vm_uuid))
- 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"