QualiSystems/vCenterShell

View on GitHub

Showing 133 of 222 total issues

Function get_or_create_network has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def get_or_create_network(self,
Severity: Major
Found in package/cloudshell/cp/vcenter/network/dvswitch/creator.py - About 1 hr to fix

    Function _get_set_mappings has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_set_mappings(self, req_to_modes):
            set_mappings = []
            if ACTION_TYPE_SET_VLAN in req_to_modes:
                set_requests = req_to_modes[ACTION_TYPE_SET_VLAN]
                for mode, actions in set_requests.items():
    Severity: Minor
    Found in package/cloudshell/cp/vcenter/commands/connect_orchestrator.py - About 1 hr to fix

    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 disconnect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def disconnect(self, si, logger, vcenter_data_model, vm_uuid, network_name=None, vm=None):
            """
            disconnect network adapter of the vm. If 'network_name' = None - disconnect ALL interfaces
            :param <str> si:
            :param logger:
    Severity: Minor
    Found in package/cloudshell/cp/vcenter/commands/disconnect_dvswitch.py - About 1 hr to fix

    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 deploy_from_image has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def deploy_from_image(self, si, logger, session, vcenter_data_model, data_holder, resource_context, reservation_id,
                              cancellation_context):
            vm_name = self.name_generator(data_holder.app_name, reservation_id)
    
            connection_details = ResourceConnectionDetailsRetriever.get_connection_details(session=session,
    Severity: Minor
    Found in package/cloudshell/cp/vcenter/vm/deploy.py - About 1 hr to fix

    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_set_vlan_result_suc has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_set_vlan_result_suc(self, act_by_mode_by_vlan_by_nic, connection_res_map):
            results = []
            for mode, vlans_to_nics in act_by_mode_by_vlan_by_nic.items():
                for vlan_id, nics_to_actions in vlans_to_nics.items():
                    for nic_name, actions in nics_to_actions.items():
    Severity: Minor
    Found in package/cloudshell/cp/vcenter/commands/connect_orchestrator.py - About 1 hr to fix

    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_remove_mappings has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_remove_mappings(self, req_to_modes, vm):
            remove_mappings = []
            if ACTION_TYPE_REMOVE_VLAN in req_to_modes:
                for mode, actions in req_to_modes[ACTION_TYPE_REMOVE_VLAN].items():
                    for action in actions:
    Severity: Minor
    Found in package/cloudshell/cp/vcenter/commands/connect_orchestrator.py - About 1 hr to fix

    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 validate_requested_save_types_supported has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_requested_save_types_supported(self, artifactSaversToActions, logger, results):
            unsupported_savers = [saver for saver in artifactSaversToActions.keys() if
                                  isinstance(saver, UnsupportedArtifactHandler)]
            if unsupported_savers:
                log_error_message = "Unsupported save type was included in save app request: {0}" \
    Severity: Minor
    Found in package/cloudshell/cp/vcenter/commands/save_sandbox.py - About 1 hr to fix

    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_network_vlan_id has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_network_vlan_id(network):
            if hasattr(network, 'config'):
                if hasattr(network.config, 'defaultPortConfig'):
                    if hasattr(network.config.defaultPortConfig, 'vlan'):
                        if hasattr(network.config.defaultPortConfig.vlan, 'vlanId'):
    Severity: Minor
    Found in package/cloudshell/cp/vcenter/network/vnic/vnic_service.py - About 1 hr to fix

    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 _group_actions_by_vlan_by_vnic has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def _group_actions_by_vlan_by_vnic(self, set_actions_grouped_by_vlan_id):
            set_act_group_by_mode_by_vlan_by_requsted_vnic = dict()
            for mode, vlan_to_action in set_actions_grouped_by_vlan_id.items():
                set_act_group_by_mode_by_vlan_by_requsted_vnic[mode] = dict()
                for vlan_id, actions in vlan_to_action.items():
    Severity: Minor
    Found in package/cloudshell/cp/vcenter/commands/connect_orchestrator.py - About 1 hr to fix

    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 clone_vm has 26 lines of code (exceeds 25 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:
    Severity: Minor
    Found in package/cloudshell/cp/vcenter/common/vcenter/vmomi_service.py - About 1 hr to fix

      Function _create_dv_port_group has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _create_dv_port_group(self, dv_port_name, dv_switch_name, dv_switch_path, si, spec, vlan_id,
      Severity: Major
      Found in package/cloudshell/cp/vcenter/network/dvswitch/creator.py - About 1 hr to fix

        Function connect_to_networks has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def connect_to_networks(self, si, logger, vm_uuid, vm_network_mappings, default_network_name,
        Severity: Major
        Found in package/cloudshell/cp/vcenter/commands/connect_dvswitch.py - About 1 hr to fix

          Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, pyvmomi_service, task_waiter, deployer, resource_model_parser, snapshot_saver, folder_manager,
          Severity: Major
          Found in package/cloudshell/cp/vcenter/commands/save_sandbox.py - About 1 hr to fix

            Function deploy_from_image has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def deploy_from_image(self, si, logger, session, vcenter_data_model, data_holder, resource_context, reservation_id,
            Severity: Major
            Found in package/cloudshell/cp/vcenter/vm/deploy.py - About 1 hr to fix

              Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self, pyvmomi_service, task_waiter, deployer, resource_model_parser, snapshot_saver, folder_manager,
              Severity: Major
              Found in package/cloudshell/cp/vcenter/commands/delete_saved_sandbox.py - About 1 hr to fix

                Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(self, environment_name, environment_path, domain, description, owner_user, owner_email,
                Severity: Major
                Found in package/cloudshell/cp/vcenter/models/QualiDriverModels.py - About 50 mins to fix

                  Function create has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def create(self, vm, name, reserved_networks, ip_regex, deployment_details_provider, wait_for_ip, logger):
                  Severity: Major
                  Found in package/cloudshell/cp/vcenter/vm/vm_details_provider.py - About 50 mins to fix

                    Function destroy has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def destroy(self, si, logger, session, vcenter_data_model, vm_uuid, vm_name, reservation_id):
                    Severity: Major
                    Found in package/cloudshell/cp/vcenter/commands/DeleteInstance.py - About 50 mins to fix

                      Function execute_deploy_from_linked_clone has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def execute_deploy_from_linked_clone(self, si, logger, vcenter_data_model, reservation_id, deployment_params, cancellation_context, folder_manager):
                      Severity: Major
                      Found in package/cloudshell/cp/vcenter/commands/deploy_vm.py - About 50 mins to fix

                        Function execute_deploy_clone_from_vm has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def execute_deploy_clone_from_vm(self, si, logger, vcenter_data_model, reservation_id, deployment_params, cancellation_context, folder_manager):
                        Severity: Major
                        Found in package/cloudshell/cp/vcenter/commands/deploy_vm.py - About 50 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language