frapposelli/vagrant-vcloud

View on GitHub

Showing 103 of 135 total issues

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

        def call(env)
          @env = env

          cfg = env[:machine].provider_config
          cnx = cfg.vcloud_cnx.driver
Severity: Major
Found in lib/vagrant-vcloud/action/power_on.rb - About 2 hrs to fix

Method get_edge_gateway_rules has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_edge_gateway_rules(edge_gateway_name, vdc_id)
          edge_gateway_id = find_edge_gateway_id(edge_gateway_name, vdc_id)

          params = {
            'method'  => :get,
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 2 hrs to fix

Method send_request has a Cognitive Complexity of 15 (exceeds 5 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: Minor
Found in lib/vagrant-vcloud/driver/base.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 remove_edge_gateway_rules has 46 lines of code (exceeds 25 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 1 hr to fix

Method get_vapp_port_forwarding_rules has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_vapp_port_forwarding_rules(vapp_id, network_name=nil)
          params = {
            'method'  => :get,
            'command' => "/vApp/vapp-#{vapp_id}/networkConfigSection"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method get_vapp_port_forwarding_rules has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

        def get_vapp_port_forwarding_rules(vapp_id, network_name=nil)
          params = {
            'method'  => :get,
            'command' => "/vApp/vapp-#{vapp_id}/networkConfigSection"
          }
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_organization has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_organization(org_id)
          params = {
            'method'  => :get,
            'command' => "/org/#{org_id}"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method compile_forwarded_ports has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def compile_forwarded_ports(machine)
          mappings = {}

          machine.config.vm.networks.each do |type, options|
            if type == :forwarded_port
Severity: Minor
Found in lib/vagrant-vcloud/util/compile_forwarded_ports.rb - About 1 hr to fix

Method set_vapp_port_forwarding_rules has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def set_vapp_port_forwarding_rules(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 get_vm has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_vm(vm_id)
          params = {
            'method'  => :get,
            'command' => "/vApp/vm-#{vm_id}"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method get_vapp_edge_public_ip has 39 lines of code (exceeds 25 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 1 hr to fix

Method vcloud_upload_box has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def vcloud_upload_box(env)
          cfg = env[:machine].provider_config
          cnx = cfg.vcloud_cnx.driver

          box_dir = env[:machine].box.directory.to_s
Severity: Minor
Found in lib/vagrant-vcloud/action/inventory_check.rb - About 1 hr to fix

Method get_vapp has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_vapp(vapp_id)
          params = {
            'method'  => :get,
            'command' => "/vApp/vapp-#{vapp_id}"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method find_edge_gateway_network has 35 lines of code (exceeds 25 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 1 hr to fix

Method call has 32 lines of code (exceeds 25 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 1 hr to fix

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

        def call(env)
          cfg = env[:machine].provider_config
          cnx = cfg.vcloud_cnx.driver
          vapp_id = env[:machine].get_vapp_id

Severity: Minor
Found in lib/vagrant-vcloud/action/destroy_vapp.rb - About 1 hr to fix

Method set_metadata has 32 lines of code (exceeds 25 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 1 hr to fix

Method action_ssh has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def self.action_ssh
        Vagrant::Action::Builder.new.tap do |b|
          # b.use ConfigValidate
          b.use Call, IsCreated do |env, b2|
            unless env[:result]
Severity: Minor
Found in lib/vagrant-vcloud/action.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 add_vapp_port_forwarding_rules has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def add_vapp_port_forwarding_rules(vapp_id, network_name, edge_network_name, config = {})
          params = {
            'method'  => :get,
            'command' => "/vApp/vapp-#{vapp_id}/networkConfigSection"
          }
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 1 hr to fix

Method call has 30 lines of code (exceeds 25 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 1 hr to fix
Severity
Category
Status
Source
Language