frapposelli/vagrant-vcloud

View on GitHub

Showing 103 of 135 total issues

Method forward_ports has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def forward_ports
          ports = {}
          edge_ports = []

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

Method action_destroy has a Cognitive Complexity of 24 (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-vcloud/action.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 forward_ports has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

        def forward_ports
          ports = {}
          edge_ports = []

          cfg = @env[:machine].provider_config
Severity: Minor
Found in lib/vagrant-vcloud/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 upload_file has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

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

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

Method vcloud_check_inventory has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

        def vcloud_check_inventory(env)
          # Will check each mandatory config value against the vCloud Director
          # Instance and will setup the global environment config values
          cfg = env[:machine].provider_config
          cnx = cfg.vcloud_cnx.driver
Severity: Minor
Found in lib/vagrant-vcloud/action/inventory_check.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 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 call has a Cognitive Complexity of 22 (exceeds 5 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: Minor
Found in lib/vagrant-vcloud/action/handle_nat_port_collisions.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 77 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-vcloud/action/handle_nat_port_collisions.rb - About 3 hrs to fix

Method validate has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def validate(machine)
        errors = _detected_errors

        # TODO: add blank?
        errors << I18n.t('vagrant_vcloud.config.hostname') if hostname.nil?
Severity: Major
Found in lib/vagrant-vcloud/config.rb - About 2 hrs to fix

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

        def call(env)
          @app.call(env)

          ssh_info = env[:machine].ssh_info

Severity: Major
Found in lib/vagrant-vcloud/action/sync_folders.rb - About 2 hrs to fix

File action.rb has 275 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'pathname'
require 'vagrant/action/builder'

module VagrantPlugins
  module VCloud
Severity: Minor
Found in lib/vagrant-vcloud/action.rb - About 2 hrs to fix

Method call has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

        def call(env)
          @app.call(env)

          ssh_info = env[:machine].ssh_info

Severity: Minor
Found in lib/vagrant-vcloud/action/sync_folders.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_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 send_request has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def send_request(params, payload = nil, content_type = nil)
            # Create a new HTTP client
            clnt = HTTPClient.new

            # Set SSL proto to TLSv1
Severity: Major
Found in lib/vagrant-vcloud/driver/base.rb - About 2 hrs to fix

Method execute has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Severity: Major
Found in lib/vagrant-vcloud/command.rb - About 2 hrs to fix

Method with_forwarded_ports has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

        def with_forwarded_ports(env)
          env[:machine].config.vm.networks.each do |type, options|
            # Ignore anything but forwarded ports
            next if type != :forwarded_port
            next if !options[:disabled].nil? && options[:disabled] == true
Severity: Minor
Found in lib/vagrant-vcloud/action/handle_nat_port_collisions.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 upload_file has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

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

Severity: Minor
Found in lib/vagrant-vcloud/driver/base.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

File build_vapp.rb has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'securerandom'
require 'etc'
require 'netaddr'

module VagrantPlugins
Severity: Minor
Found in lib/vagrant-vcloud/action/build_vapp.rb - About 2 hrs to fix

File base.rb has 256 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-vcloud/driver/base.rb - About 2 hrs to fix
Severity
Category
Status
Source
Language