lib/fog/vcloud_director/models/compute/vm.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

        def memory=(new_memory)
          has_changed = ( memory != new_memory.to_i )
          not_first_set = !memory.nil?
          attributes[:memory] = new_memory.to_i
          if not_first_set && has_changed
Severity: Minor
Found in lib/fog/vcloud_director/models/compute/vm.rb and 1 other location - About 25 mins to fix
lib/fog/vcloud_director/models/compute/vm.rb on lines 162..169

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 cpu=(new_cpu)
          has_changed = ( cpu != new_cpu.to_i )
          not_first_set = !cpu.nil?
          attributes[:cpu] = new_cpu.to_i
          if not_first_set && has_changed
Severity: Minor
Found in lib/fog/vcloud_director/models/compute/vm.rb and 1 other location - About 25 mins to fix
lib/fog/vcloud_director/models/compute/vm.rb on lines 152..159

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 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 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/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 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_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 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 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 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 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

There are no issues that match your filters.

Category
Status