frapposelli/vagrant-vcloud

View on GitHub
lib/vagrant-vcloud/driver/version_5_1.rb

Summary

Maintainability
F
3 wks
Test Coverage

File version_5_1.rb has 1766 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'ruby-progressbar'
require 'set'
require 'netaddr'
require 'uri'

Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 4 days to fix

Method compose_vapp_from_vm has a Cognitive Complexity of 167 (exceeds 5 allowed). Consider refactoring.
Open

        def compose_vapp_from_vm(vdc, vapp_name, vapp_description, vm_list = {}, network_config = [], _cfg)
          builder = Nokogiri::XML::Builder.new do |xml|
            xml.ComposeVAppParams('xmlns' => 'http://www.vmware.com/vcloud/v1.5',
                                  'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1',
                                  'deploy' => 'false',
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 3 days 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 set_vm_hardware has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
Open

        def set_vm_hardware(vm_id, cfg)
          params = {
            'method'  => :get,
            'command' => "/vApp/vm-#{vm_id}/virtualHardwareSection"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 2 days 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 recompose_vapp_from_vm has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring.
Open

        def recompose_vapp_from_vm(vapp_id, vm_list = {}, network_config = [], _cfg)
          original_vapp = get_vapp(vapp_id)

          builder = Nokogiri::XML::Builder.new do |xml|
          xml.RecomposeVAppParams(
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 2 days 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

Class Version_5_1 has 58 methods (exceeds 20 allowed). Consider refactoring.
Open

      class Version_5_1 < Base
        attr_reader :auth_key, :id

        ##
        # Init the driver with the Vagrantfile information
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 day to fix

Method set_vm_hardware has 161 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def set_vm_hardware(vm_id, cfg)
          params = {
            'method'  => :get,
            'command' => "/vApp/vm-#{vm_id}/virtualHardwareSection"
          }
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 6 hrs to fix

Method upload_ovf has 132 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def upload_ovf(vdc_id, vapp_name, vapp_description, ovf_file, catalog_id, upload_options = {})
          # if send_manifest is not set, setting it true
          if upload_options[:send_manifest].nil? ||
             upload_options[:send_manifest]
            upload_manifest = 'true'
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 5 hrs to fix

Method compose_vapp_from_vm has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def compose_vapp_from_vm(vdc, vapp_name, vapp_description, vm_list = {}, network_config = [], _cfg)
          builder = Nokogiri::XML::Builder.new do |xml|
            xml.ComposeVAppParams('xmlns' => 'http://www.vmware.com/vcloud/v1.5',
                                  'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1',
                                  'deploy' => 'false',
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 5 hrs to fix

Method add_edge_gateway_rules has 108 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def add_edge_gateway_rules(edge_gateway_name, vdc_id, edge_gateway_ip, vapp_id, ports)
          edge_vapp_ip = get_vapp_edge_public_ip(vapp_id)
          edge_network_id = find_edge_gateway_network(
            edge_gateway_name,
            vdc_id,
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 4 hrs to fix

Method recompose_vapp_from_vm has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def recompose_vapp_from_vm(vapp_id, vm_list = {}, network_config = [], _cfg)
          original_vapp = get_vapp(vapp_id)

          builder = Nokogiri::XML::Builder.new do |xml|
          xml.RecomposeVAppParams(
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 3 hrs to fix

Method get_vapp_edge_public_ip has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

        def get_vapp_edge_public_ip(vapp_id, network_name=nil)
          return @cached_vapp_edge_public_ips["#{vapp_id}#{network_name}"] unless @cached_vapp_edge_public_ips["#{vapp_id}#{network_name}"].nil?

          # Check the network configuration section
          params = {
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 2 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 get_edge_gateway_rules has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_edge_gateway_rules(edge_gateway_name, vdc_id)
          edge_gateway_id = find_edge_gateway_id(edge_gateway_name, vdc_id)

          params = {
            'method'  => :get,
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 2 hrs to fix

Method remove_edge_gateway_rules has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def remove_edge_gateway_rules(edge_gateway_name, vdc_id, edge_gateway_ip, vapp_id)
          edge_vapp_ip = get_vapp_edge_public_ip(vapp_id)
          edge_gateway_id = find_edge_gateway_id(edge_gateway_name, vdc_id)

          params = {
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method get_vapp_port_forwarding_rules has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_vapp_port_forwarding_rules(vapp_id, network_name=nil)
          params = {
            'method'  => :get,
            'command' => "/vApp/vapp-#{vapp_id}/networkConfigSection"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method get_vapp_port_forwarding_rules has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

        def get_vapp_port_forwarding_rules(vapp_id, network_name=nil)
          params = {
            'method'  => :get,
            'command' => "/vApp/vapp-#{vapp_id}/networkConfigSection"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - 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

Method get_organization has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_organization(org_id)
          params = {
            'method'  => :get,
            'command' => "/org/#{org_id}"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method set_vapp_port_forwarding_rules has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def set_vapp_port_forwarding_rules(vapp_id, network_name, config = {})
          builder = Nokogiri::XML::Builder.new do |xml|
          xml.NetworkConfigSection(
            'xmlns' => 'http://www.vmware.com/vcloud/v1.5',
            'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1') {
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method get_vm has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_vm(vm_id)
          params = {
            'method'  => :get,
            'command' => "/vApp/vm-#{vm_id}"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method get_vapp_edge_public_ip has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_vapp_edge_public_ip(vapp_id, network_name=nil)
          return @cached_vapp_edge_public_ips["#{vapp_id}#{network_name}"] unless @cached_vapp_edge_public_ips["#{vapp_id}#{network_name}"].nil?

          # Check the network configuration section
          params = {
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method get_vapp has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_vapp(vapp_id)
          params = {
            'method'  => :get,
            'command' => "/vApp/vapp-#{vapp_id}"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method find_edge_gateway_network has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def find_edge_gateway_network(edge_gateway_name, vdc_id, edge_gateway_ip)
          params = {
            'method'  => :get,
            'command' => '/query?type=edgeGateway&' \
                         'format=records&' \
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

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

        def set_metadata(link, data)
          params = {
            'method'  => :post,
            'command' => "/#{link}/metadata"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method add_vapp_port_forwarding_rules has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def add_vapp_port_forwarding_rules(vapp_id, network_name, edge_network_name, config = {})
          params = {
            'method'  => :get,
            'command' => "/vApp/vapp-#{vapp_id}/networkConfigSection"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method set_ovf_properties has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def set_ovf_properties(vm_id, properties)
          params = {
            'method'  => :get,
            'command' => "/vApp/vm-#{vm_id}/productSections"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

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

        def create_vapp_from_template(vdc, vapp_name, vapp_description, vapp_template_id, poweron = false)
          builder = Nokogiri::XML::Builder.new do |xml|
            xml.InstantiateVAppTemplateParams(
              'xmlns'     => 'http://www.vmware.com/vcloud/v1.5',
              'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

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

        def get_catalog_id_by_name(organization, catalog_name)
          result = nil

          organization[:catalogs].each do |catalog|
            if catalog[0].downcase == catalog_name.downcase
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

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

        def set_vm_network_config(vm_id, network_name, config = {})
          builder = Nokogiri::XML::Builder.new do |xml|
            xml.NetworkConnectionSection(
              'xmlns' => 'http://www.vmware.com/vcloud/v1.5',
              'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1') {
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method upload_ovf has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def upload_ovf(vdc_id, vapp_name, vapp_description, ovf_file, catalog_id, upload_options = {})
          # if send_manifest is not set, setting it true
          if upload_options[:send_manifest].nil? ||
             upload_options[:send_manifest]
            upload_manifest = 'true'
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - 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

Method get_vdc has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_vdc(vdc_id)
          params = {
            'method'  => :get,
            'command' => "/vdc/#{vdc_id}"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method set_vapp_network_config has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def set_vapp_network_config(vapp_id, network_name, config = {})
          builder = Nokogiri::XML::Builder.new do |xml|
            xml.NetworkConfigSection(
              'xmlns' => 'http://www.vmware.com/vcloud/v1.5',
              'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1'
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method set_vm_network_connected has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def set_vm_network_connected(vm_id)
          params = {
            'method'  => :get,
            'command' => "/vApp/vm-#{vm_id}/networkConnectionSection"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method set_vm_network_config has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def set_vm_network_config(vm_id, network_name, config = {})
          builder = Nokogiri::XML::Builder.new do |xml|
            xml.NetworkConnectionSection(
              'xmlns' => 'http://www.vmware.com/vcloud/v1.5',
              'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1') {
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 55 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

Method add_edge_gateway_rules has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def add_edge_gateway_rules(edge_gateway_name, vdc_id, edge_gateway_ip, vapp_id, ports)
          edge_vapp_ip = get_vapp_edge_public_ip(vapp_id)
          edge_network_id = find_edge_gateway_network(
            edge_gateway_name,
            vdc_id,
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 55 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

Method set_ovf_properties has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def set_ovf_properties(vm_id, properties)
          params = {
            'method'  => :get,
            'command' => "/vApp/vm-#{vm_id}/productSections"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 55 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

Method set_vm_guest_customization has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def set_vm_guest_customization(vm_id, computer_name, config = {})
          builder = Nokogiri::XML::Builder.new do |xml|
          xml.GuestCustomizationSection(
            'xmlns' => 'http://www.vmware.com/vcloud/v1.5',
            'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1') {
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 55 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

Method upload_ovf has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def upload_ovf(vdc_id, vapp_name, vapp_description, ovf_file, catalog_id, upload_options = {})
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                changed = true if orig_ip.nil? || nic[:ip].upcase != orig_ip.upcase
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

              if hdd_parent_id == item.css('rasd|Parent').first.text
                hdd_address_on_parent = [ hdd_address_on_parent,  item.css('rasd|AddressOnParent').first.text.to_i ].max
              end
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 45 mins to fix

Method compose_vapp_from_vm has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def compose_vapp_from_vm(vdc, vapp_name, vapp_description, vm_list = {}, network_config = [], _cfg)
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                item.css('rasd|Address').first.content = nic[:mac] if !nic[:mac].nil?
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                changed = true if nic[:mac].upcase != orig_mac.upcase
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                item.css('rasd|AddressOnParent').first.content = nic_address_on_parent if nic_address_on_parent != orig_parent
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                if nic[:ip_mode].upcase == 'DHCP'
                  conn['vcloud:ipAddressingMode'] = 'DHCP'
                elsif nic[:ip_mode].upcase == 'STATIC'
                  conn['vcloud:ipAddressingMode'] = 'MANUAL'
                  conn['vcloud:ipAddress'] = nic[:ip]
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

              if hdd_parent_id.nil?
                hdd_parent_id = item.css('rasd|Parent').first.text
                hdd_bus_type = item.css('rasd|HostResource').first[:busType]
                hdd_bus_sub_type = item.css('rasd|HostResource').first[:busSubType]
              end
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 45 mins to fix

Method create_vapp_from_template has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def create_vapp_from_template(vdc, vapp_name, vapp_description, vapp_template_id, poweron = false)
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 35 mins to fix

Method add_edge_gateway_rules has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def add_edge_gateway_rules(edge_gateway_name, vdc_id, edge_gateway_ip, vapp_id, ports)
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 35 mins to fix

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

        def find_edge_gateway_network(edge_gateway_name, vdc_id, edge_gateway_ip)
          params = {
            'method'  => :get,
            'command' => '/query?type=edgeGateway&' \
                         'format=records&' \
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.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

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

        def set_metadata(link, data)
          params = {
            'method'  => :post,
            'command' => "/#{link}/metadata"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.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

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

        def remove_edge_gateway_rules(edge_gateway_name, vdc_id, edge_gateway_ip, vapp_id)
          edge_vapp_ip = get_vapp_edge_public_ip(vapp_id)
          edge_gateway_id = find_edge_gateway_id(edge_gateway_name, vdc_id)

          params = {
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.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

Method get_edge_gateway_rules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def get_edge_gateway_rules(edge_gateway_name, vdc_id)
          edge_gateway_id = find_edge_gateway_id(edge_gateway_name, vdc_id)

          params = {
            'method'  => :get,
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 25 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

Method get_catalog_id_by_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def get_catalog_id_by_name(organization, catalog_name)
          result = nil

          organization[:catalogs].each do |catalog|
            if catalog[0].downcase == catalog_name.downcase
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 25 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

Method get_vapp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def get_vapp(vapp_id)
          params = {
            'method'  => :get,
            'command' => "/vApp/vapp-#{vapp_id}"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 25 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

            vm_list.each do |vm_name, vm_id|
                xml.SourcedItem {
                  xml.Source('href' => "#{@api_url}/vAppTemplate/vm-#{vm_id}", 'name' => vm_name)
                  xml.InstantiationParams {
                    if _cfg.enable_guest_customization.nil? || _cfg.enable_guest_customization
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 1 other location - About 7 hrs to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 838..890

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

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

              vm_list.each do |vm_name, vm_id|
                xml.SourcedItem {
                  xml.Source('href' => "#{@api_url}/vAppTemplate/vm-#{vm_id}", 'name' => vm_name)
                  xml.InstantiationParams {
                    if _cfg.enable_guest_customization.nil? || _cfg.enable_guest_customization
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 1 other location - About 7 hrs to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 935..987

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

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_catalog_item(catalog_item_id)
          params = {
            'method'  => :get,
            'command' => "/catalogItem/#{catalog_item_id}"
          }
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 1 other location - About 1 hr to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 188..206

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

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_catalog(catalog_id)
          params = {
            'method'  => :get,
            'command' => "/catalog/#{catalog_id}"
          }
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 1 other location - About 1 hr to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 342..360

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

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

              if nic[:ip_mode].upcase == 'DHCP'
                conn['vcloud:ipAddressingMode'] = 'DHCP'
              elsif nic[:ip_mode].upcase == 'STATIC'
                conn['vcloud:ipAddressingMode'] = 'MANUAL'
                conn['vcloud:ipAddress'] = nic[:ip]
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 1 other location - About 1 hr to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 2112..2120

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

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

                if nic[:ip_mode].upcase == 'DHCP'
                  conn['vcloud:ipAddressingMode'] = 'DHCP'
                elsif nic[:ip_mode].upcase == 'STATIC'
                  conn['vcloud:ipAddressingMode'] = 'MANUAL'
                  conn['vcloud:ipAddress'] = nic[:ip]
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 1 other location - About 1 hr to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 2190..2198

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

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 4 locations. Consider refactoring.
Open

        def poweroff_vm(vm_id)
          builder = Nokogiri::XML::Builder.new do |xml|
            xml.UndeployVAppParams(
            'xmlns' => 'http://www.vmware.com/vcloud/v1.5'
          ) { xml.UndeployPowerAction 'powerOff' }
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 3 other locations - About 1 hr to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 480..498
lib/vagrant-vcloud/driver/version_5_1.rb on lines 602..620
lib/vagrant-vcloud/driver/version_5_1.rb on lines 625..643

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

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 4 locations. Consider refactoring.
Open

        def suspend_vm(vm_id)
          builder = Nokogiri::XML::Builder.new do |xml|
            xml.UndeployVAppParams(
              'xmlns' => 'http://www.vmware.com/vcloud/v1.5'
            ) { xml.UndeployPowerAction 'suspend' }
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 3 other locations - About 1 hr to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 480..498
lib/vagrant-vcloud/driver/version_5_1.rb on lines 577..595
lib/vagrant-vcloud/driver/version_5_1.rb on lines 602..620

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

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 4 locations. Consider refactoring.
Open

        def shutdown_vm(vm_id)
          builder = Nokogiri::XML::Builder.new do |xml|
            xml.UndeployVAppParams(
            'xmlns' => 'http://www.vmware.com/vcloud/v1.5'
          ) { xml.UndeployPowerAction 'shutdown' }
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 3 other locations - About 1 hr to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 480..498
lib/vagrant-vcloud/driver/version_5_1.rb on lines 577..595
lib/vagrant-vcloud/driver/version_5_1.rb on lines 625..643

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

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 4 locations. Consider refactoring.
Open

        def poweroff_vapp(vapp_id)
          builder = Nokogiri::XML::Builder.new do |xml|
            xml.UndeployVAppParams(
              'xmlns' => 'http://www.vmware.com/vcloud/v1.5'
            ) { xml.UndeployPowerAction 'powerOff' }
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 3 other locations - About 1 hr to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 577..595
lib/vagrant-vcloud/driver/version_5_1.rb on lines 602..620
lib/vagrant-vcloud/driver/version_5_1.rb on lines 625..643

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

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

          if nconfig.size > 1
            nconfig.each {|c|
              pn = c.css('/Configuration/ParentNetwork')
              next if pn.size == 0
              if pn.first['name'] == network_name
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 1 other location - About 40 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 1173..1183

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

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

          if nconfig.size > 1
            nconfig.each {|c|
              pn = c.css('/Configuration/ParentNetwork')
              next if pn.size == 0
              if pn.first['name'] == network_name
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 1 other location - About 40 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 1616..1626

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

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 cfg.memory
                if item.at_css('rasd|VirtualQuantity').content != cfg.memory.to_s
                  item.at_css('rasd|VirtualQuantity').content = cfg.memory
                  item.at_css('rasd|ElementName').content = "#{cfg.memory} MB of memory"
                  changed = true
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 1 other location - About 25 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 2065..2069

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 cfg.cpus
                if item.at_css('rasd|VirtualQuantity').content != cfg.cpus.to_s
                  item.at_css('rasd|VirtualQuantity').content = cfg.cpus
                  item.at_css('rasd|ElementName').content = "#{cfg.cpus} virtual CPU(s)"
                  changed = true
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 1 other location - About 25 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 2074..2078

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 8 locations. Consider refactoring.
Open

        def poweron_vapp(vapp_id)
          params = {
            'method'  => :post,
            'command' => "/vApp/vapp-#{vapp_id}/power/action/powerOn"
          }
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 7 other locations - About 20 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 503..511
lib/vagrant-vcloud/driver/version_5_1.rb on lines 519..527
lib/vagrant-vcloud/driver/version_5_1.rb on lines 534..542
lib/vagrant-vcloud/driver/version_5_1.rb on lines 651..659
lib/vagrant-vcloud/driver/version_5_1.rb on lines 666..674
lib/vagrant-vcloud/driver/version_5_1.rb on lines 679..687
lib/vagrant-vcloud/driver/version_5_1.rb on lines 1248..1256

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

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 8 locations. Consider refactoring.
Open

        def reboot_vm(vm_id)
          params = {
            'method'  => :post,
            'command' => "/vApp/vm-#{vm_id}/power/action/reboot"
          }
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 7 other locations - About 20 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 503..511
lib/vagrant-vcloud/driver/version_5_1.rb on lines 519..527
lib/vagrant-vcloud/driver/version_5_1.rb on lines 534..542
lib/vagrant-vcloud/driver/version_5_1.rb on lines 547..555
lib/vagrant-vcloud/driver/version_5_1.rb on lines 666..674
lib/vagrant-vcloud/driver/version_5_1.rb on lines 679..687
lib/vagrant-vcloud/driver/version_5_1.rb on lines 1248..1256

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

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 8 locations. Consider refactoring.
Open

        def reboot_vapp(vapp_id)
          params = {
            'method'  => :post,
            'command' => "/vApp/vapp-#{vapp_id}/power/action/reboot"
          }
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 7 other locations - About 20 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 503..511
lib/vagrant-vcloud/driver/version_5_1.rb on lines 534..542
lib/vagrant-vcloud/driver/version_5_1.rb on lines 547..555
lib/vagrant-vcloud/driver/version_5_1.rb on lines 651..659
lib/vagrant-vcloud/driver/version_5_1.rb on lines 666..674
lib/vagrant-vcloud/driver/version_5_1.rb on lines 679..687
lib/vagrant-vcloud/driver/version_5_1.rb on lines 1248..1256

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

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 8 locations. Consider refactoring.
Open

        def suspend_vapp(vapp_id)
          params = {
            'method'  => :post,
            'command' => "/vApp/vapp-#{vapp_id}/power/action/suspend"
          }
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 7 other locations - About 20 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 519..527
lib/vagrant-vcloud/driver/version_5_1.rb on lines 534..542
lib/vagrant-vcloud/driver/version_5_1.rb on lines 547..555
lib/vagrant-vcloud/driver/version_5_1.rb on lines 651..659
lib/vagrant-vcloud/driver/version_5_1.rb on lines 666..674
lib/vagrant-vcloud/driver/version_5_1.rb on lines 679..687
lib/vagrant-vcloud/driver/version_5_1.rb on lines 1248..1256

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

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 8 locations. Consider refactoring.
Open

        def reset_vm(vm_id)
          params = {
            'method'  => :post,
            'command' => "/vApp/vm-#{vm_id}/power/action/reset"
          }
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 7 other locations - About 20 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 503..511
lib/vagrant-vcloud/driver/version_5_1.rb on lines 519..527
lib/vagrant-vcloud/driver/version_5_1.rb on lines 534..542
lib/vagrant-vcloud/driver/version_5_1.rb on lines 547..555
lib/vagrant-vcloud/driver/version_5_1.rb on lines 651..659
lib/vagrant-vcloud/driver/version_5_1.rb on lines 679..687
lib/vagrant-vcloud/driver/version_5_1.rb on lines 1248..1256

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

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 8 locations. Consider refactoring.
Open

        def poweron_vm(vm_id)
          params = {
            'method'  => :post,
            'command' => "/vApp/vm-#{vm_id}/power/action/powerOn"
          }
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 7 other locations - About 20 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 503..511
lib/vagrant-vcloud/driver/version_5_1.rb on lines 519..527
lib/vagrant-vcloud/driver/version_5_1.rb on lines 534..542
lib/vagrant-vcloud/driver/version_5_1.rb on lines 547..555
lib/vagrant-vcloud/driver/version_5_1.rb on lines 651..659
lib/vagrant-vcloud/driver/version_5_1.rb on lines 666..674
lib/vagrant-vcloud/driver/version_5_1.rb on lines 1248..1256

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

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 8 locations. Consider refactoring.
Open

        def reset_vapp(vapp_id)
          params = {
            'method'  => :post,
            'command' => "/vApp/vapp-#{vapp_id}/power/action/reset"
          }
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 7 other locations - About 20 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 503..511
lib/vagrant-vcloud/driver/version_5_1.rb on lines 519..527
lib/vagrant-vcloud/driver/version_5_1.rb on lines 547..555
lib/vagrant-vcloud/driver/version_5_1.rb on lines 651..659
lib/vagrant-vcloud/driver/version_5_1.rb on lines 666..674
lib/vagrant-vcloud/driver/version_5_1.rb on lines 679..687
lib/vagrant-vcloud/driver/version_5_1.rb on lines 1248..1256

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

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 8 locations. Consider refactoring.
Open

        def redeploy_edge_gateway(edge_gateway_id)
          params = {
            'method'  => :post,
            'command' => "/admin/edgeGateway/#{edge_gateway_id}/action/redeploy"
          }
Severity: Major
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 7 other locations - About 20 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 503..511
lib/vagrant-vcloud/driver/version_5_1.rb on lines 519..527
lib/vagrant-vcloud/driver/version_5_1.rb on lines 534..542
lib/vagrant-vcloud/driver/version_5_1.rb on lines 547..555
lib/vagrant-vcloud/driver/version_5_1.rb on lines 651..659
lib/vagrant-vcloud/driver/version_5_1.rb on lines 666..674
lib/vagrant-vcloud/driver/version_5_1.rb on lines 679..687

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

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_vm(vm_id)
          params = {
            'method'  => :delete,
            'command' => "/vApp/vm-#{vm_id}"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 1 other location - About 20 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 467..475

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

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_vapp(vapp_id)
          params = {
            'method'  => :delete,
            'command' => "/vApp/vapp-#{vapp_id}"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 1 other location - About 20 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 562..570

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

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