frapposelli/vagrant-vcloud

View on GitHub

Showing 103 of 135 total issues

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 !net_id
                    # TEMP FIX: permissions issues at the Org Level for vApp authors
                    #           to "view" Org vDC Networks but they can see them at the
                    #           Organization vDC level (tsugliani)
                    net_id = cfg.vdc[:networks][net[:vdc_network_name]]
Severity: Major
Found in lib/vagrant-vcloud/action/build_vapp.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

Avoid deeply nested control flow statements.
Open

                if guest_customization_admin_password.nil? ||
                   guest_customization_admin_password.empty?
                  errors << I18n.t('vagrant_vcloud.gc.admin_password_gs')
                end
Severity: Major
Found in lib/vagrant-vcloud/config.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

                  if !net_id
                    raise 'vCloud User credentials has insufficient privileges'
                  end
Severity: Major
Found in lib/vagrant-vcloud/action/build_vapp.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

Method execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def execute
        options = {}
        opts = OptionParser.new do |o|
          o.banner = 'Usage: vagrant vcloud [options]'

Severity: Minor
Found in lib/vagrant-vcloud/command.rb - About 45 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

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

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_templateid, poweron = false)
Severity: Minor
Found in lib/vagrant-vcloud/driver/base.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 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 compose_vapp_from_vm has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

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

        def read_state(env)
          # FIXME: this part needs some cleanup
          begin
            cfg = env[:machine].provider_config
            cnx = cfg.vcloud_cnx.driver
Severity: Minor
Found in lib/vagrant-vcloud/action/read_state.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 call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def call(env)
          cfg = env[:machine].provider_config
          cnx = cfg.vcloud_cnx.driver
          vapp_id = env[:machine].get_vapp_id
          vm_name = cfg.name ? cfg.name.to_sym : env[:machine].name
Severity: Minor
Found in lib/vagrant-vcloud/action/unmap_port_forwardings.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 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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def call(env)
          config = env[:machine].provider_config

          if !config.vcloud_cnx or !config.vcloud_cnx.driver.auth_key
            @logger.info('Connecting to vCloud Director...')
Severity: Minor
Found in lib/vagrant-vcloud/action/connect_vcloud.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

Severity
Category
Status
Source
Language