frapposelli/vagrant-vcloud

View on GitHub

Showing 135 of 135 total issues

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

                  if !net_id
                    # TEMP FIX: permissions issues at the Org Level for vApp authors
                    #           to "view" Org vDC Networks but they can see them at the
                    #           Organization vDC level (tsugliani)
                    net_id = cfg.vdc[:networks][net[:vdc_network_name]]
Severity: Major
Found in lib/vagrant-vcloud/action/build_vapp.rb - About 45 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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

          if env[:machine].box.name.to_s.include? '/'
            box_file = env[:machine].box.name.rpartition('/').last.to_s
            box_name = env[:machine].box.name.to_s
          else
            box_file = env[:machine].box.name.to_s
Severity: Minor
Found in lib/vagrant-vcloud/action/inventory_check.rb and 1 other location - About 40 mins to fix
lib/vagrant-vcloud/action/inventory_check.rb on lines 92..97

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 37.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

          if nconfig.size > 1
            nconfig.each {|c|
              pn = c.css('/Configuration/ParentNetwork')
              next if pn.size == 0
              if pn.first['name'] == network_name
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 1 other location - About 40 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 1616..1626

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 37.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

          if env[:machine].box.name.to_s.include? '/'
            box_file = env[:machine].box.name.rpartition('/').last.to_s
            box_name = env[:machine].box.name.to_s
          else
            box_file = env[:machine].box.name.to_s
Severity: Minor
Found in lib/vagrant-vcloud/action/inventory_check.rb and 1 other location - About 40 mins to fix
lib/vagrant-vcloud/action/inventory_check.rb on lines 24..29

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 37.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

          if nconfig.size > 1
            nconfig.each {|c|
              pn = c.css('/Configuration/ParentNetwork')
              next if pn.size == 0
              if pn.first['name'] == network_name
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb and 1 other location - About 40 mins to fix
lib/vagrant-vcloud/driver/version_5_1.rb on lines 1173..1183

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 37.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method create_vapp_from_template has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def create_vapp_from_template(vdc, vapp_name, vapp_description, vapp_template_id, poweron = false)
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 35 mins to fix

Method add_edge_gateway_rules has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def add_edge_gateway_rules(edge_gateway_name, vdc_id, edge_gateway_ip, vapp_id, ports)
Severity: Minor
Found in lib/vagrant-vcloud/driver/version_5_1.rb - About 35 mins to fix

Method create_vapp_from_template has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def create_vapp_from_template(vdc, vapp_name, vapp_description,
                                      vapp_templateid, poweron = false)
Severity: Minor
Found in lib/vagrant-vcloud/driver/base.rb - About 35 mins to fix

Method compose_vapp_from_vm has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def compose_vapp_from_vm(vdc, vapp_name, vapp_description,
                                 vm_list = {}, network_config = {})
Severity: Minor
Found in lib/vagrant-vcloud/driver/base.rb - About 35 mins to fix

Method find_edge_gateway_network has a Cognitive Complexity of 7 (exceeds 5 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 35 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 remove_edge_gateway_rules has a Cognitive Complexity of 7 (exceeds 5 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 35 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_metadata has a Cognitive Complexity of 7 (exceeds 5 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 35 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 read_state has a Cognitive Complexity of 7 (exceeds 5 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 35 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 call has a Cognitive Complexity of 7 (exceeds 5 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 35 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      def self.action_halt
        Vagrant::Action::Builder.new.tap do |b|
          b.use ConfigValidate
          b.use ConnectVCloud
          b.use Call, IsPaused do |env, b2|
Severity: Minor
Found in lib/vagrant-vcloud/action.rb and 1 other location - About 30 mins to fix
lib/vagrant-vcloud/action.rb on lines 73..80

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      def self.action_poweroff
        Vagrant::Action::Builder.new.tap do |b|
          b.use ConfigValidate
          b.use ConnectVCloud
          b.use Call, IsPaused do |env, b2|
Severity: Minor
Found in lib/vagrant-vcloud/action.rb and 1 other location - About 30 mins to fix
lib/vagrant-vcloud/action.rb on lines 84..91

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method get_edge_gateway_rules has a Cognitive Complexity of 6 (exceeds 5 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 25 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

Severity
Category
Status
Source
Language