frapposelli/vagrant-vcloud

View on GitHub

Showing 103 of 135 total issues

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 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 action_destroy has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.action_destroy
        Vagrant::Action::Builder.new.tap do |b|
          b.use Call, DestroyConfirm do |env, b2|
            if env[:result]
              b2.use ConfigValidate
Severity: Minor
Found in lib/vagrant-vcloud/action.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 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 read_state has 26 lines of code (exceeds 25 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 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 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 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_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 initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def initialize(id, host_port, guest_port, network_name, edge_network_id, edge_network_name, options)
Severity: Major
Found in lib/vagrant-vcloud/model/forwarded_port.rb - About 50 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 action_up has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def self.action_up
        Vagrant::Action::Builder.new.tap do |b|
          b.use ConfigValidate
          b.use Call, IsCreated do |env, b2|
            b2.use HandleBox unless env[:result]
Severity: Minor
Found in lib/vagrant-vcloud/action.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

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

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/base.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
Severity
Category
Status
Source
Language