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

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

                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

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