cloudfoundry-community/bosh-cloudstack-cpi

View on GitHub
bosh_vsphere_cpi/lib/ruby_vim_sdk/core_types.rb

Summary

Maintainability
A
1 hr
Test Coverage

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

    create_data_type("vmodl.query.PropertyCollector.ObjectUpdate", "ObjectUpdate", "vmodl.DynamicData", "vmodl.query.version.version1", [["kind", "vmodl.query.PropertyCollector.ObjectUpdate.Kind", "vmodl.query.version.version1"], ["obj", "vmodl.ManagedObject", "vmodl.query.version.version1"], ["changeSet", "vmodl.query.PropertyCollector.Change[]", "vmodl.query.version.version1", {:optional => true}], ["missingSet", "vmodl.query.PropertyCollector.MissingProperty[]", "vmodl.query.version.version1", {:optional => true}]])
Severity: Major
Found in bosh_vsphere_cpi/lib/ruby_vim_sdk/core_types.rb and 8 other locations - About 20 mins to fix
bosh_vsphere_cpi/lib/ruby_vim_sdk/core_types.rb on lines 52..52
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 275..275
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 673..673
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 683..683
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 1291..1291
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 1662..1662
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 1812..1812
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 2309..2309

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

    create_data_type("vmodl.query.PropertyCollector.TraversalSpec", "TraversalSpec", "vmodl.query.PropertyCollector.SelectionSpec", "vmodl.query.version.version1", [["type", "vmodl.TypeName", "vmodl.query.version.version1"], ["path", "vmodl.PropertyPath", "vmodl.query.version.version1"], ["skip", "boolean", "vmodl.query.version.version1", {:optional => true}], ["selectSet", "vmodl.query.PropertyCollector.SelectionSpec[]", "vmodl.query.version.version1", {:optional => true}]])
Severity: Major
Found in bosh_vsphere_cpi/lib/ruby_vim_sdk/core_types.rb and 8 other locations - About 20 mins to fix
bosh_vsphere_cpi/lib/ruby_vim_sdk/core_types.rb on lines 57..57
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 275..275
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 673..673
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 683..683
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 1291..1291
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 1662..1662
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 1812..1812
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 2309..2309

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

    create_managed_type("vmodl.query.PropertyCollector", "PropertyCollector", "vmodl.ManagedObject", "vmodl.query.version.version1", [["filter", "vmodl.query.PropertyCollector.Filter[]", "vmodl.query.version.version1", {:optional => true}, "System.View"]], [["createFilter", "CreateFilter", "vmodl.query.version.version1", [["spec", "vmodl.query.PropertyCollector.FilterSpec", "vmodl.query.version.version1", {}, nil], ["partialUpdates", "boolean", "vmodl.query.version.version1", {}, nil]], [{}, "vmodl.query.PropertyCollector.Filter", "vmodl.query.PropertyCollector.Filter"], "System.View", ["vmodl.query.InvalidProperty"]], ["retrieveContents", "RetrieveProperties", "vmodl.query.version.version1", [["specSet", "vmodl.query.PropertyCollector.FilterSpec[]", "vmodl.query.version.version1", {}, nil]], [{:optional => true}, "vmodl.query.PropertyCollector.ObjectContent[]", "vmodl.query.PropertyCollector.ObjectContent[]"], "System.Anonymous", ["vmodl.query.InvalidProperty"]], ["checkForUpdates", "CheckForUpdates", "vmodl.query.version.version1", [["version", "string", "vmodl.query.version.version1", {:optional => true}, nil]], [{:optional => true}, "vmodl.query.PropertyCollector.UpdateSet", "vmodl.query.PropertyCollector.UpdateSet"], "System.View", ["vmodl.query.InvalidCollectorVersion"]], ["waitForUpdates", "WaitForUpdates", "vmodl.query.version.version1", [["version", "string", "vmodl.query.version.version1", {:optional => true}, nil]], [{}, "vmodl.query.PropertyCollector.UpdateSet", "vmodl.query.PropertyCollector.UpdateSet"], "System.View", ["vmodl.query.InvalidCollectorVersion"]], ["cancelWaitForUpdates", "CancelWaitForUpdates", "vmodl.query.version.version1", [], [{}, "void", "void"], "System.View", nil], ["waitForUpdatesEx", "WaitForUpdatesEx", "vmodl.query.version.version3", [["version", "string", "vmodl.query.version.version3", {:optional => true}, nil], ["options", "vmodl.query.PropertyCollector.WaitOptions", "vmodl.query.version.version3", {:optional => true}, nil]], [{:optional => true}, "vmodl.query.PropertyCollector.UpdateSet", "vmodl.query.PropertyCollector.UpdateSet"], "System.View", ["vmodl.query.InvalidCollectorVersion"]], ["retrievePropertiesEx", "RetrievePropertiesEx", "vmodl.query.version.version3", [["specSet", "vmodl.query.PropertyCollector.FilterSpec[]", "vmodl.query.version.version3", {}, nil], ["options", "vmodl.query.PropertyCollector.RetrieveOptions", "vmodl.query.version.version3", {}, nil]], [{:optional => true}, "vmodl.query.PropertyCollector.RetrieveResult", "vmodl.query.PropertyCollector.RetrieveResult"], "System.Anonymous", ["vmodl.query.InvalidProperty"]], ["continueRetrievePropertiesEx", "ContinueRetrievePropertiesEx", "vmodl.query.version.version3", [["token", "string", "vmodl.query.version.version3", {}, nil]], [{}, "vmodl.query.PropertyCollector.RetrieveResult", "vmodl.query.PropertyCollector.RetrieveResult"], "System.Anonymous", ["vmodl.query.InvalidProperty"]], ["cancelRetrievePropertiesEx", "CancelRetrievePropertiesEx", "vmodl.query.version.version3", [["token", "string", "vmodl.query.version.version3", {}, nil]], [{}, "void", "void"], "System.Anonymous", ["vmodl.query.InvalidProperty"]], ["createPropertyCollector", "CreatePropertyCollector", "vmodl.query.version.version3", [], [{}, "vmodl.query.PropertyCollector", "vmodl.query.PropertyCollector"], "System.View", nil], ["destroy", "DestroyPropertyCollector", "vmodl.query.version.version3", [], [{}, "void", "void"], "System.View", nil]])
Severity: Minor
Found in bosh_vsphere_cpi/lib/ruby_vim_sdk/core_types.rb and 2 other locations - About 15 mins to fix
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 344..344
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 2714..2714

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

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