Showing 212 of 460 total issues

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

          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

            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 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 = 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

        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

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

        def power_off
          requires :id
          begin
            response = service.post_power_off_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 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
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 power_off
          requires :id
          begin
            response = service.post_power_off_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 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 undeploy
          requires :id
          begin
            response = service.post_undeploy_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 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 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/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 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 6 locations. Consider refactoring.
Open

            if filter[:network_uid] && filter[:network_uid].is_a?(String) && !filter[:network_uid].empty?
              next if network.to_hash["VNET"]["UID"] != filter[:network_uid]
            end
Severity: Major
Found in lib/fog/opennebula/requests/compute/list_networks.rb and 5 other locations - About 20 mins to fix
lib/fog/opennebula/requests/compute/list_networks.rb on lines 19..21
lib/fog/opennebula/requests/compute/list_networks.rb on lines 22..24
lib/fog/opennebula/requests/compute/template_pool.rb on lines 46..48
lib/fog/opennebula/requests/compute/template_pool.rb on lines 49..51
lib/fog/opennebula/requests/compute/template_pool.rb on lines 52..54

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

      class Real
        def linode_ip_list(linode_id, ip_id=nil)
          options = {}
          if ip_id
            options.merge!(:ipaddressId => ip_id)
Severity: Minor
Found in lib/fog/linode/requests/compute/linode_ip_list.rb and 1 other location - About 20 mins to fix
lib/fog/linode/requests/compute/linode_disk_list.rb on lines 4..14

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

        def item_list
          data = service.get_organization(organization.id).body
          items = data[:Link].select { |link| link[:type] == "application/vnd.vmware.vcloud.vdc+xml" }
          items.each{|item| service.add_id_from_href!(item) }
          items
Severity: Minor
Found in lib/fog/vcloud_director/models/compute/vdcs.rb and 1 other location - About 20 mins to fix
lib/fog/vcloud_director/models/compute/catalogs.rb on lines 21..25

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

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

            if filter[:name] && filter[:name].is_a?(String) && !filter[:name].empty?
              next if t.to_hash["VMTEMPLATE"]["NAME"] != filter[:name]
            end
Severity: Major
Found in lib/fog/opennebula/requests/compute/template_pool.rb and 5 other locations - About 20 mins to fix
lib/fog/opennebula/requests/compute/list_networks.rb on lines 19..21
lib/fog/opennebula/requests/compute/list_networks.rb on lines 22..24
lib/fog/opennebula/requests/compute/list_networks.rb on lines 25..27
lib/fog/opennebula/requests/compute/template_pool.rb on lines 49..51
lib/fog/opennebula/requests/compute/template_pool.rb on lines 52..54

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 shutdown
          requires :id
          begin
            response = service.post_shutdown_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 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 reset
          requires :id
          begin
            response = service.post_reset_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 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

Severity
Category
Status
Source
Language