gosddc/vagrant-vcloudair

View on GitHub

Showing 109 of 109 total issues

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

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

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

Class Version_5_1 has 53 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-vcloudair/driver/version_5_1.rb - About 7 hrs to fix

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

        def compose_vapp_from_vm(vdc, vapp_name, vapp_description, vm_list = {}, network_config = {})
          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',
Severity: Minor
Found in lib/vagrant-vcloudair/driver/version_5_1.rb - About 6 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 call has 162 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def call(env)
          # FIXME: we need to find a way to clean things up when a SIGINT get
          # called... see env[:interrupted] in the vagrant code

          cfg = env[:machine].provider_config
Severity: Major
Found in lib/vagrant-vcloudair/action/build_vapp.rb - About 6 hrs to fix

Class Base has 40 methods (exceeds 20 allowed). Consider refactoring.
Open

      class Base
        include Vagrant::Util::Retryable

        def initialize
          @logger = Log4r::Logger.new('vagrant::provider::vcloudair::base')
Severity: Minor
Found in lib/vagrant-vcloudair/driver/base.rb - About 5 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-vcloudair/driver/version_5_1.rb - About 5 hrs to fix

Method validate has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

      def validate(machine)
        errors = _detected_errors

        errors << I18n.t('vagrant_vcloudair.errors.config.username') if username.nil?
        errors << I18n.t('vagrant_vcloudair.errors.config.password') if password.nil?
Severity: Minor
Found in lib/vagrant-vcloudair/config.rb - About 5 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 action_destroy has a Cognitive Complexity of 33 (exceeds 5 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-vcloudair/action.rb - About 4 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 call has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

        def call(env)
          # FIXME: we need to find a way to clean things up when a SIGINT get
          # called... see env[:interrupted] in the vagrant code

          cfg = env[:machine].provider_config
Severity: Minor
Found in lib/vagrant-vcloudair/action/build_vapp.rb - About 4 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 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-vcloudair/driver/version_5_1.rb - About 4 hrs to fix

File base.rb has 346 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'log4r'
require 'vagrant/util/busy'
require 'vagrant/util/platform'
require 'vagrant/util/retryable'
require 'vagrant/util/subprocess'
Severity: Minor
Found in lib/vagrant-vcloudair/driver/base.rb - About 4 hrs to fix

Method command_vcloud_network has 98 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def command_vcloud_network(cfg, vapp_id, ssh_host)
        # FIXME: this needs to be fixed to accomodate the bridged scenario
        # potentially showing only the assigned IPs in the VMs

        puts 'Fetching vCloud Air network settings ...'
Severity: Major
Found in lib/vagrant-vcloudair/command.rb - About 3 hrs to fix

Method command_vcloud_network has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

      def command_vcloud_network(cfg, vapp_id, ssh_host)
        # FIXME: this needs to be fixed to accomodate the bridged scenario
        # potentially showing only the assigned IPs in the VMs

        puts 'Fetching vCloud Air network settings ...'
Severity: Minor
Found in lib/vagrant-vcloudair/command.rb - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method vcloud_check_inventory has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def vcloud_check_inventory(env)
          # Will check each mandatory config value against the vCloud Air
          # Instance and will setup the global environment config values
          cfg = env[:machine].provider_config
          cnx = cfg.vcloudair_cnx.driver
Severity: Major
Found in lib/vagrant-vcloudair/action/inventory_check.rb - About 3 hrs to fix

Method initialize has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def initialize(cloud_id, username, password, vdc_name)
          # Setup the base
          super()

          @username = username
Severity: Major
Found in lib/vagrant-vcloudair/driver/meta.rb - About 3 hrs to fix

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

        def compose_vapp_from_vm(vdc, vapp_name, vapp_description, vm_list = {}, network_config = {})
          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',
Severity: Major
Found in lib/vagrant-vcloudair/driver/version_5_1.rb - About 3 hrs to fix

Method upload_file has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def upload_file(upload_url, upload_file, vapp_template, config = {})
          # Set chunksize to 5M if not specified otherwise
          chunk_size = (config[:chunksize] || 5_242_880)
          @logger.debug("Set chunksize to #{chunk_size} bytes")

Severity: Major
Found in lib/vagrant-vcloudair/driver/base.rb - About 3 hrs to fix

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

        def forward_ports
          ports = []
          edge_ports = []

          cfg = @env[:machine].provider_config
Severity: Minor
Found in lib/vagrant-vcloudair/action/forward_ports.rb - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method call has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def call(env)
          @logger.info('Detecting any forwarded port collisions...')

          # Determine a list of usable ports for repair
          usable_ports = Set.new(env[:machine].config.vm.usable_port_range)
Severity: Major
Found in lib/vagrant-vcloudair/action/handle_nat_port_collisions.rb - About 3 hrs to fix

Method read_ssh_info has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def read_ssh_info(env)
          return nil if env[:machine].id.nil?

          cfg = env[:machine].provider_config
          cnx = cfg.vcloudair_cnx.driver
Severity: Major
Found in lib/vagrant-vcloudair/action/read_ssh_info.rb - About 3 hrs to fix
Severity
Category
Status
Source
Language