QualiSystems/vCenterShell

View on GitHub
package/cloudshell/cp/vcenter/commands/command_orchestrator.py

Summary

Maintainability
F
3 days
Test Coverage

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
Severity: Minor
Found in package/cloudshell/cp/vcenter/commands/command_orchestrator.py - About 7 hrs to fix

    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
    Severity: Minor
    Found in package/cloudshell/cp/vcenter/commands/command_orchestrator.py - About 3 hrs to fix

      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
      
      
      Severity: Minor
      Found in package/cloudshell/cp/vcenter/commands/command_orchestrator.py - About 1 hr to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            def deploy_clone_from_vm(self, context, deploy_action, cancellation_context):
                """
                Deploy Cloned VM From VM Command, will deploy vm from template
        
                :param CancellationContext cancellation_context:
        package/cloudshell/cp/vcenter/commands/command_orchestrator.py on lines 218..240

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 85.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            def deploy_from_template(self, context, deploy_action, cancellation_context):
                """
                Deploy From Template Command, will deploy vm from template
        
                :param CancellationContext cancellation_context:
        package/cloudshell/cp/vcenter/commands/command_orchestrator.py on lines 242..264

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 85.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            def get_snapshots(self, context):
                """
                Returns list of snapshots
                :param context: resource context of the vCenterShell
                :type context: models.QualiDriverModels.ResourceCommandContext
        package/cloudshell/cp/vcenter/commands/command_orchestrator.py on lines 321..336

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 48.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            def disconnect_all(self, context, ports):
                """
                Disconnect All Command, will the assign all the vnics on the vm to the default network,
                which is sign to be disconnected
        
        
        package/cloudshell/cp/vcenter/commands/command_orchestrator.py on lines 510..521

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 48.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            def save_sandbox(self, context, save_actions, cancellation_context):
                """
                Save sandbox command, persists an artifact of existing VMs, from which new vms can be restored
                :param ResourceCommandContext context:
                :param list[SaveApp] save_actions:
        package/cloudshell/cp/vcenter/commands/command_orchestrator.py on lines 204..216

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 40.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                self.save_app_command = SaveAppCommand(pyvmomi_service=pv_service,
                                                       task_waiter=synchronous_task_waiter,
                                                       deployer=vm_deployer,
                                                       resource_model_parser=self.resource_model_parser,
                                                       snapshot_saver=self.snapshot_saver,
        package/cloudshell/cp/vcenter/commands/command_orchestrator.py on lines 170..175

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 40.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            def delete_saved_sandbox(self, context, delete_saved_apps, cancellation_context):
                """
                Delete a saved sandbox, along with any vms associated with it
                :param ResourceCommandContext context:
                :param list[DeleteSavedApp] delete_saved_apps:
        package/cloudshell/cp/vcenter/commands/command_orchestrator.py on lines 191..202

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 40.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                self.delete_saved_sandbox_command = DeleteSavedSandboxCommand(pyvmomi_service=pv_service,
                                                                              task_waiter=synchronous_task_waiter,
                                                                              deployer=vm_deployer,
                                                                              resource_model_parser=self.resource_model_parser,
                                                                              snapshot_saver=self.snapshot_saver,
        package/cloudshell/cp/vcenter/commands/command_orchestrator.py on lines 161..166

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 40.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        There are no issues that match your filters.

        Category
        Status