Showing 460 of 460 total issues

Method unmount_volume has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def unmount_volume(volume_or_position)
          if volume_or_position.kind_of? Fixnum
            self.volumes.delete_at(volume_or_position)
            # assign to update attributes
            return self.volumes = self.volumes
Severity: Minor
Found in lib/fog/cloudsigma/models/server.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

Method network_to_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def network_to_attributes(net)
          return if net.nil?
          h = {
            :id    => net["VNET"]["ID"],
            :name  => net["VNET"]["NAME"],
Severity: Minor
Found in lib/fog/opennebula/requests/compute/list_networks.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

Method image_pool has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def image_pool(filter = { })

          images = ::OpenNebula::ImagePool.new(client)
          if filter[:mine].nil?
            images.info!
Severity: Minor
Found in lib/fog/opennebula/requests/compute/image_pool.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

Method all has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def all(options={})
          [[:kvm, :isKVM], [:xen, :isXen]].each do |type, param|
            options[param] = options[type] ? 1 : 0 if options.has_key?(type)
          end
          load kernels(options)
Severity: Minor
Found in lib/fog/linode/models/compute/kernels.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

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

      class Mock
        def linode_disk_resize(linode_id, disk_id, size)
          response = Excon::Response.new
          response.status = 200
          response.body = {
Severity: Minor
Found in lib/fog/linode/requests/compute/linode_disk_resize.rb and 3 other locations - About 25 mins to fix
lib/fog/linode/requests/compute/linode_disk_createfromimage.rb on lines 22..32
lib/fog/linode/requests/compute/linode_disk_duplicate.rb on lines 18..28
lib/fog/linode/requests/compute/linode_disk_imagize.rb on lines 20..32

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 30.

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 4 locations. Consider refactoring.
Open

      class Mock
        def linode_disk_duplicate(linode_id, disk_id)
          response = Excon::Response.new
          response.status = 200
          response.body = {
Severity: Minor
Found in lib/fog/linode/requests/compute/linode_disk_duplicate.rb and 3 other locations - About 25 mins to fix
lib/fog/linode/requests/compute/linode_disk_createfromimage.rb on lines 22..32
lib/fog/linode/requests/compute/linode_disk_imagize.rb on lines 20..32
lib/fog/linode/requests/compute/linode_disk_resize.rb on lines 19..31

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 30.

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 4 locations. Consider refactoring.
Open

      class Mock
        def linode_disk_createfromimage(linode_id, image_id, label, size, password, sshkey)
          response = Excon::Response.new
          response.status = 200
          response.body = {
Severity: Minor
Found in lib/fog/linode/requests/compute/linode_disk_createfromimage.rb and 3 other locations - About 25 mins to fix
lib/fog/linode/requests/compute/linode_disk_duplicate.rb on lines 18..28
lib/fog/linode/requests/compute/linode_disk_imagize.rb on lines 20..32
lib/fog/linode/requests/compute/linode_disk_resize.rb on lines 19..31

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 30.

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 4 locations. Consider refactoring.
Open

      class Mock
        def linode_disk_imagize(linode_id, disk_id, description, label)
          response = Excon::Response.new
          response.status = 200
          response.body = {
Severity: Minor
Found in lib/fog/linode/requests/compute/linode_disk_imagize.rb and 3 other locations - About 25 mins to fix
lib/fog/linode/requests/compute/linode_disk_createfromimage.rb on lines 22..32
lib/fog/linode/requests/compute/linode_disk_duplicate.rb on lines 18..28
lib/fog/linode/requests/compute/linode_disk_resize.rb on lines 19..31

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 30.

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 memory_section(xml, memory)
          xml['ovf'].Item do
            xml['rasd'].AllocationUnits 'byte * 2^20'
            xml['rasd'].InstanceID 6
            xml['rasd'].ResourceType 4
Severity: Minor
Found in lib/fog/vcloud_director/requests/compute/post_reconfigure_vm.rb and 1 other location - About 25 mins to fix
lib/fog/vcloud_director/requests/compute/post_reconfigure_vm.rb on lines 62..67

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 29.

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

            CloneVAppTemplateParams(attrs) {
              if options.key?(:Description)
                Description options[:Description]
              end
              Source(:href => "#{end_point}vAppTemplate/#{source_id}")
lib/fog/vcloud_director/requests/compute/post_clone_media.rb on lines 28..34

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 29.

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

      if availability
        for service in services
          for collection in self.class_for(service).collections
            unless self.respond_to?(collection)
              self.class_eval <<-EOS, __FILE__, __LINE__
Severity: Minor
Found in lib/fog/bin/opennebula.rb and 1 other location - About 25 mins to fix
lib/fog/bin.rb on lines 32..40

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 29.

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

          if api_version.to_f >= 5.1
            storage_class_id = media[:vdc_storage_class]
            body[:VdcStorageProfile] = {
              :href => make_href("vdcStorageProfile/#{storage_class_id}"),
              :name => data[:vdc_storage_classes][storage_class_id][:name],
Severity: Minor
Found in lib/fog/vcloud_director/requests/compute/get_media.rb and 1 other location - About 25 mins to fix
lib/fog/vcloud_director/requests/compute/get_disk.rb on lines 109..114

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 29.

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

        if availability
          for service in services
            for collection in self.class_for(service).collections
              unless self.respond_to?(collection)
                self.class_eval <<-EOS, __FILE__, __LINE__
Severity: Minor
Found in lib/fog/bin.rb and 1 other location - About 25 mins to fix
lib/fog/bin/opennebula.rb on lines 35..43

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 29.

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 cpu_section(xml, cpu)
          xml['ovf'].Item do
            xml['rasd'].AllocationUnits 'hertz * 10 ^ 6'
            xml['rasd'].InstanceID 5
            xml['rasd'].ResourceType 3
Severity: Minor
Found in lib/fog/vcloud_director/requests/compute/post_reconfigure_vm.rb and 1 other location - About 25 mins to fix
lib/fog/vcloud_director/requests/compute/post_reconfigure_vm.rb on lines 71..76

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 29.

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

          if api_version.to_f >= 5.1
            storage_class_id = disk[:vdc_storage_class]
            body[:VdcStorageProfile] = {
              :href => make_href("vdcStorageProfile/#{storage_class_id}"),
              :name => data[:vdc_storage_classes][storage_class_id][:name],
Severity: Minor
Found in lib/fog/vcloud_director/requests/compute/get_disk.rb and 1 other location - About 25 mins to fix
lib/fog/vcloud_director/requests/compute/get_media.rb on lines 97..102

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 29.

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

            CloneMediaParams(attrs) {
              if options.key?(:Description)
                Description options[:Description]
              end
              Source(:href => "#{end_point}media/#{source_id}")
Severity: Minor
Found in lib/fog/vcloud_director/requests/compute/post_clone_media.rb and 1 other location - About 25 mins to fix
lib/fog/vcloud_director/requests/compute/post_clone_vapp_template.rb on lines 29..35

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 29.

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 14 locations. Consider refactoring.
Open

        def reboot
          requires :id
          begin
            response = service.post_reboot_vapp(id)
          rescue Fog::Compute::VcloudDirector::BadRequest => ex
Severity: Major
Found in lib/fog/vcloud_director/models/compute/vapp.rb and 13 other locations - About 20 mins to fix
lib/fog/vcloud_director/models/compute/vapp.rb on lines 60..68
lib/fog/vcloud_director/models/compute/vapp.rb on lines 72..80
lib/fog/vcloud_director/models/compute/vapp.rb on lines 96..104
lib/fog/vcloud_director/models/compute/vapp.rb on lines 108..116
lib/fog/vcloud_director/models/compute/vapp.rb on lines 120..128
lib/fog/vcloud_director/models/compute/vapp.rb on lines 131..139
lib/fog/vcloud_director/models/compute/vm.rb on lines 48..56
lib/fog/vcloud_director/models/compute/vm.rb on lines 60..68
lib/fog/vcloud_director/models/compute/vm.rb on lines 72..80
lib/fog/vcloud_director/models/compute/vm.rb on lines 84..92
lib/fog/vcloud_director/models/compute/vm.rb on lines 95..103
lib/fog/vcloud_director/models/compute/vm.rb on lines 107..115
lib/fog/vcloud_director/models/compute/vm.rb on lines 119..127

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 28.

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 14 locations. Consider refactoring.
Open

        def suspend
          requires :id
          begin
            response = service.post_suspend_vapp(id)
          rescue Fog::Compute::VcloudDirector::BadRequest => ex
Severity: Major
Found in lib/fog/vcloud_director/models/compute/vapp.rb and 13 other locations - About 20 mins to fix
lib/fog/vcloud_director/models/compute/vapp.rb on lines 60..68
lib/fog/vcloud_director/models/compute/vapp.rb on lines 72..80
lib/fog/vcloud_director/models/compute/vapp.rb on lines 84..92
lib/fog/vcloud_director/models/compute/vapp.rb on lines 96..104
lib/fog/vcloud_director/models/compute/vapp.rb on lines 108..116
lib/fog/vcloud_director/models/compute/vapp.rb on lines 131..139
lib/fog/vcloud_director/models/compute/vm.rb on lines 48..56
lib/fog/vcloud_director/models/compute/vm.rb on lines 60..68
lib/fog/vcloud_director/models/compute/vm.rb on lines 72..80
lib/fog/vcloud_director/models/compute/vm.rb on lines 84..92
lib/fog/vcloud_director/models/compute/vm.rb on lines 95..103
lib/fog/vcloud_director/models/compute/vm.rb on lines 107..115
lib/fog/vcloud_director/models/compute/vm.rb on lines 119..127

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 28.

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 14 locations. Consider refactoring.
Open

        def suspend
          requires :id
          begin
            response = service.post_suspend_vapp(id)
          rescue Fog::Compute::VcloudDirector::BadRequest => ex
Severity: Major
Found in lib/fog/vcloud_director/models/compute/vm.rb and 13 other locations - About 20 mins to fix
lib/fog/vcloud_director/models/compute/vapp.rb on lines 60..68
lib/fog/vcloud_director/models/compute/vapp.rb on lines 72..80
lib/fog/vcloud_director/models/compute/vapp.rb on lines 84..92
lib/fog/vcloud_director/models/compute/vapp.rb on lines 96..104
lib/fog/vcloud_director/models/compute/vapp.rb on lines 108..116
lib/fog/vcloud_director/models/compute/vapp.rb on lines 120..128
lib/fog/vcloud_director/models/compute/vapp.rb on lines 131..139
lib/fog/vcloud_director/models/compute/vm.rb on lines 48..56
lib/fog/vcloud_director/models/compute/vm.rb on lines 60..68
lib/fog/vcloud_director/models/compute/vm.rb on lines 72..80
lib/fog/vcloud_director/models/compute/vm.rb on lines 84..92
lib/fog/vcloud_director/models/compute/vm.rb on lines 95..103
lib/fog/vcloud_director/models/compute/vm.rb on lines 107..115

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 28.

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 14 locations. Consider refactoring.
Open

        def power_on
          requires :id
          begin
            response = service.post_power_on_vapp(id)
          rescue Fog::Compute::VcloudDirector::BadRequest => ex
Severity: Major
Found in lib/fog/vcloud_director/models/compute/vm.rb and 13 other locations - About 20 mins to fix
lib/fog/vcloud_director/models/compute/vapp.rb on lines 60..68
lib/fog/vcloud_director/models/compute/vapp.rb on lines 72..80
lib/fog/vcloud_director/models/compute/vapp.rb on lines 84..92
lib/fog/vcloud_director/models/compute/vapp.rb on lines 96..104
lib/fog/vcloud_director/models/compute/vapp.rb on lines 108..116
lib/fog/vcloud_director/models/compute/vapp.rb on lines 120..128
lib/fog/vcloud_director/models/compute/vapp.rb on lines 131..139
lib/fog/vcloud_director/models/compute/vm.rb on lines 48..56
lib/fog/vcloud_director/models/compute/vm.rb on lines 72..80
lib/fog/vcloud_director/models/compute/vm.rb on lines 84..92
lib/fog/vcloud_director/models/compute/vm.rb on lines 95..103
lib/fog/vcloud_director/models/compute/vm.rb on lines 107..115
lib/fog/vcloud_director/models/compute/vm.rb on lines 119..127

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 28.

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

Severity
Category
Status
Source
Language