fog/fog-vsphere

View on GitHub
lib/fog/vsphere/requests/compute/vm_clone.rb

Summary

Maintainability
F
2 wks
Test Coverage

Method vm_clone has a Cognitive Complexity of 418 (exceeds 5 allowed). Consider refactoring.
Open

        def vm_clone(options = {})
          # Option handling
          options = vm_clone_check_options(options)

          # Options['template_path']<~String>
Severity: Minor
Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 1 wk 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

Method vm_clone has 376 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def vm_clone(options = {})
          # Option handling
          options = vm_clone_check_options(options)

          # Options['template_path']<~String>
Severity: Major
Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 1 day to fix

    File vm_clone.rb has 558 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Fog
      module Vsphere
        class Compute
          module Shared
            private
    Severity: Major
    Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 1 day to fix

      Method vm_clone_check_options has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

              def vm_clone_check_options(options)
                default_options = {
                  'force'        => false,
                  'linked_clone' => false,
                  'nic_type' => 'VirtualE1000'
      Severity: Minor
      Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 3 hrs 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

      Method modify_template_nics_specs has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def modify_template_nics_specs(vm_mob_ref, nics, datacenter)
                specs = []
                template_nics = vm_mob_ref.config.hardware.device.grep(RbVmomi::VIM::VirtualEthernetCard)
                modified_nics = nics.take(template_nics.size)
                new_nics      = nics.drop(template_nics.size)
      Severity: Minor
      Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 1 hr to fix

        Method vm_clone_check_options has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def vm_clone_check_options(options)
                  default_options = {
                    'force'        => false,
                    'linked_clone' => false,
                    'nic_type' => 'VirtualE1000'
        Severity: Minor
        Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 1 hr to fix

          Method modify_template_nics_simple_spec has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def modify_template_nics_simple_spec(network_label, nic_type, network_adapter_device_key, datacenter)
                    config_spec_operation = RbVmomi::VIM::VirtualDeviceConfigSpecOperation('edit')
                    # Get the portgroup and handle it from there.
                    network = get_raw_network(network_label, datacenter)
                    nic_backing_info = if network.is_a? RbVmomi::VIM::DistributedVirtualPortgroup
          Severity: Minor
          Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                              custom_spec['nicSettingMap'][0] = {} if custom_spec['nicSettingMap'].empty?
            Severity: Major
            Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              raise ArgumentError, 'identification->domainAdminPassword->plainText is required when using Sysprep identity and identification -> joinDomain' unless identity['Sysprep']['identification']['domainAdminPassword'].key?('plainText')
              Severity: Major
              Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                raise ArgumentError, 'guiUnattended->password->plainText is required when using Sysprep identity and guiUnattended -> password' unless identity['Sysprep']['guiUnattended']['password'].key?('plainText')
                Severity: Major
                Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                  raise ArgumentError, 'identification->domainAdmin is required when using Sysprep identity and identification -> joinDomain' unless identity['Sysprep']['identification'].key?('domainAdmin')
                  Severity: Major
                  Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    raise ArgumentError, 'licenseFilePrintData->autoMode is required when using Sysprep identity and licenseFilePrintData' unless identity['Sysprep']['licenseFilePrintData'].key?('autoMode')
                    Severity: Major
                    Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                        custom_spec['nicSettingMap'][0]['adapter']['ip'] = custom_spec['ipsettings']['ip'] if custom_spec['ipsettings'].key?('ip')
                      Severity: Major
                      Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                        raise ArgumentError, 'identification->domainAdminPassword->value is required when using Sysprep identity and identification -> joinDomain' unless identity['Sysprep']['identification']['domainAdminPassword'].key?('value')
                        Severity: Major
                        Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                        raise ArgumentError, 'SysprepText -> value is required when using SysprepText identity' unless identity['SysprepText'].key?('value')
                          Severity: Major
                          Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                              custom_spec['nicSettingMap'][0]['adapter'] = {} unless custom_spec['nicSettingMap'][0].key?('adapter')
                            Severity: Major
                            Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                custom_spec['nicSettingMap'][0]['adapter']['gateway'] = custom_spec['ipsettings']['gateway'] if custom_spec['ipsettings'].key?('gateway')
                              Severity: Major
                              Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                  custom_spec['nicSettingMap'][0]['adapter']['subnetMask'] = custom_spec['ipsettings']['subnetMask'] if custom_spec['ipsettings'].key?('subnetMask')
                                Severity: Major
                                Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                  raise ArgumentError, 'guiUnattended->password->value is required when using Sysprep identity and guiUnattended -> password' unless identity['Sysprep']['guiUnattended']['password'].key?('value')
                                  Severity: Major
                                  Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                      custom_spec['nicSettingMap'][0]['adapter']['dnsServerList'] = custom_spec['ipsettings']['dnsServerList'] if custom_spec['ipsettings'].key?('dnsServerList')
                                    Severity: Major
                                    Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                      raise ArgumentError, 'identification->domainAdminPassword is required when using Sysprep identity and identification -> joinDomain' unless identity['Sysprep']['identification'].key?('domainAdmin')
                                      Severity: Major
                                      Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                        raise ArgumentError, 'commandList is required when using Sysprep identity and guiRunOnce' unless identity['Sysprep']['guiRunOnce'].key?('commandList')
                                        Severity: Major
                                        Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                              raise ArgumentError, 'SubnetMask is required when assigning static IPv6 when using nicSettingMap -> Adapter -> ipV6Spec' unless nic['adapter']['ipV6Spec'].key?('subnetMask')
                                          Severity: Major
                                          Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                              custom_spec['nicSettingMap'][0]['adapter']['dnsDomain'] = custom_spec['ipsettings']['domain'] if custom_spec['ipsettings'].key?('domain')
                                            Severity: Major
                                            Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                custom_spec['nicSettingMap'] = [] unless custom_spec.key?('nicSettingMap')
                                              Severity: Major
                                              Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                                  if custom_spec['ipsettings'].key?('ip') && !custom_spec['ipsettings'].key?('subnetMask')
                                                                    raise ArgumentError, 'subnetMask is required for static ip'
                                                                  end
                                                Severity: Major
                                                Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                                  if identity['Sysprep']['licenseFilePrintData'].key?('autoUsers')
                                                                    custom_licenseFilePrintData.autoUsers = identity['Sysprep']['licenseFilePrintData']['autoUsers'] if identity['Sysprep']['licenseFilePrintData']['autoMode'] == 'PerServer'
                                                                  end
                                                  Severity: Major
                                                  Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                    raise ArgumentError, "Unsupported autoMode, supported modes are : 'perSeat' or 'perServer'" unless %w[perSeat perServer].include? identity['Sysprep']['licenseFilePrintData']['autoMode']
                                                    Severity: Major
                                                    Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                                                      Method modify_template_volumes_specs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                              def modify_template_volumes_specs(vm_mob_ref, volumes)
                                                                template_volumes = vm_mob_ref.config.hardware.device.grep(RbVmomi::VIM::VirtualDisk)
                                                      
                                                                specs = []
                                                                template_volumes.zip(modified_volumes(vm_mob_ref, volumes)).each do |template_volume, new_volume|
                                                      Severity: Minor
                                                      Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 35 mins 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

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

                                                                      new_vm = nil
                                                                      Fog.wait_for(150, 15) do
                                                                        begin
                                                                          (new_vm = dest_folder.find(options['name'], RbVmomi::VIM::VirtualMachine)) || raise(Fog::Vsphere::Errors::NotFound)
                                                                        rescue Fog::Vsphere::Errors::NotFound
                                                      Severity: Minor
                                                      Found in lib/fog/vsphere/requests/compute/vm_clone.rb and 1 other location - About 45 mins to fix
                                                      lib/fog/vsphere/requests/compute/vm_clone.rb on lines 730..738

                                                      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 39.

                                                      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

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

                                                                    new_vm = nil
                                                                    Fog.wait_for(150, 15) do
                                                                      begin
                                                                        (new_vm = dest_folder.find(options['name'], RbVmomi::VIM::VirtualMachine)) || raise(Fog::Vsphere::Errors::NotFound)
                                                                      rescue Fog::Vsphere::Errors::NotFound
                                                      Severity: Minor
                                                      Found in lib/fog/vsphere/requests/compute/vm_clone.rb and 1 other location - About 45 mins to fix
                                                      lib/fog/vsphere/requests/compute/vm_clone.rb on lines 684..692

                                                      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 39.

                                                      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

                                                                      if nic['adapter'].key?('netBIOS')
                                                                        # https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.IPSettings.NetBIOSMode.html
                                                                        # Fields:
                                                                        #   netBIOS: string matching: 'disableNetBIOS','enableNetBIOS' or 'enableNetBIOSViaDhcp' ** REQUIRED **
                                                                        #
                                                      Severity: Minor
                                                      Found in lib/fog/vsphere/requests/compute/vm_clone.rb and 1 other location - About 25 mins to fix
                                                      lib/fog/vsphere/requests/compute/vm_clone.rb on lines 580..582

                                                      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 31.

                                                      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

                                                                    if custom_spec['options'].key?('reboot')
                                                                      raise ArgumentError, "Unsupported reboot option, supported options are : 'noreboot', 'reboot' or 'shutdown'" unless %w[noreboot reboot shutdown].include? custom_spec['options']['reboot']
                                                                      custom_options.reboot = RBVmomi::VIM.CustomizationSysprepRebootOption(custom_spec['options']['reboot'])
                                                      Severity: Minor
                                                      Found in lib/fog/vsphere/requests/compute/vm_clone.rb and 1 other location - About 25 mins to fix
                                                      lib/fog/vsphere/requests/compute/vm_clone.rb on lines 547..553

                                                      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 31.

                                                      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

                                                                if options.key?('storage_pod') && !options['storage_pod'].nil? && !get_raw_storage_pod(options['storage_pod'], options['datacenter'])
                                                                  raise Fog::Vsphere::Compute::NotFound, "Storage Pod #{options['storage_pod']} Doesn't Exist!"
                                                                end
                                                      Severity: Minor
                                                      Found in lib/fog/vsphere/requests/compute/vm_clone.rb and 1 other location - About 25 mins to fix
                                                      lib/fog/vsphere/requests/compute/vm_clone.rb on lines 30..32

                                                      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 30.

                                                      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

                                                                if options.key?('datastore') && !options['datastore'].nil? && !get_raw_datastore(options['datastore'], options['datacenter'])
                                                                  raise Fog::Vsphere::Compute::NotFound, "Datastore #{options['datastore']} Doesn't Exist!"
                                                                end
                                                      Severity: Minor
                                                      Found in lib/fog/vsphere/requests/compute/vm_clone.rb and 1 other location - About 25 mins to fix
                                                      lib/fog/vsphere/requests/compute/vm_clone.rb on lines 33..35

                                                      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 30.

                                                      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

                                                                      custom_guiUnattended.password = RbVmomi::VIM.CustomizationPassword(
                                                                        plainText: identity['Sysprep']['guiUnattended']['password']['plainText'],
                                                                        value: identity['Sysprep']['guiUnattended']['password']['value']
                                                                      )
                                                      Severity: Minor
                                                      Found in lib/fog/vsphere/requests/compute/vm_clone.rb and 1 other location - About 15 mins to fix
                                                      lib/fog/vsphere/requests/compute/vm_clone.rb on lines 437..440

                                                      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 26.

                                                      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

                                                                      custom_identification.domainAdminPassword = RbVmomi::VIM.CustomizationPassword(
                                                                        plainText: identity['Sysprep']['identification']['domainAdminPassword']['plainText'],
                                                                        value: identity['Sysprep']['identification']['domainAdminPassword']['value']
                                                                      )
                                                      Severity: Minor
                                                      Found in lib/fog/vsphere/requests/compute/vm_clone.rb and 1 other location - About 15 mins to fix
                                                      lib/fog/vsphere/requests/compute/vm_clone.rb on lines 412..415

                                                      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 26.

                                                      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