cloudfoundry-community/bosh-cloudstack-cpi

View on GitHub

Showing 1,705 of 1,705 total issues

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

    create_data_type("vim.host.DiskPartitionInfo.BlockRange", "HostDiskPartitionBlockRange", "vmodl.DynamicData", "vim.version.version1", [["partition", "int", "vim.version.version1", {:optional => true}], ["type", "string", "vim.version.version1"], ["start", "vim.host.DiskDimensions.Lba", "vim.version.version1"], ["end", "vim.host.DiskDimensions.Lba", "vim.version.version1"]])
Severity: Minor
Found in bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb and 4 other locations - About 15 mins to fix
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 1653..1653
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 1724..1724
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 1822..1822
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 1829..1829

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

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

    create_managed_type("vim.PolicyManager", "PolicyManager", "vmodl.ManagedObject", "vim.version.policy", nil, [["definePolicy", "PolicyManagerDefinePolicy", "vim.version.policy", [["policySpec", "string", "vim.version.policy", {}, nil], ["policyUrn", "string", "vim.version.policy", {:optional => true}, nil]], [{}, "string", "string"], "System.View", nil], ["editEntities", "PolicyManagerEditEntities", "vim.version.policy", [["urn", "string", "vim.version.policy", {}, nil], ["entityId", "string[]", "vim.version.policy", {}, nil], ["add", "boolean", "vim.version.policy", {}, nil]], [{}, "string", "string"], "System.View", nil], ["deletePolicy", "PolicyManagerDeletePolicy", "vim.version.policy", [["urn", "string", "vim.version.policy", {}, nil]], [{}, "void", "void"], "System.View", ["vim.fault.PolicyUrnInvalid"]], ["setPolicyState", "PolicyManagerSetPolicyState", "vim.version.policy", [["urn", "string", "vim.version.policy", {}, nil], ["state", "string", "vim.version.policy", {}, nil], ["entityId", "string[]", "vim.version.policy", {:optional => true}, nil]], [{}, "string", "string"], "System.View", nil], ["queryPolicy", "PolicyManagerQueryPolicy", "vim.version.policy", [["criteria", "vmodl.KeyAnyValue[]", "vim.version.policy", {:optional => true}, nil]], [{}, "string", "string"], "System.View", ["vim.fault.InvalidKey", "vim.fault.InvalidKeyValue", "vim.fault.InvalidKeyCombination"]]])
Severity: Minor
Found in bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb and 3 other locations - About 15 mins to fix
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 260..260
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 260..260
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 1473..1473

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

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

    create_managed_type("vim.StorageResourceManager", "StorageResourceManager", "vmodl.ManagedObject", "vim.version.version6", nil, [["ConfigureDatastoreIORM", "ConfigureDatastoreIORM_Task", "vim.version.version6", [["datastore", "vim.Datastore", "vim.version.version6", {}, "Datastore.Config"], ["spec", "vim.StorageResourceManager.IORMConfigSpec", "vim.version.version6", {}, nil]], [{}, "vim.Task", "void"], nil, ["vim.fault.IORMNotSupportedHostOnDatastore", "vim.fault.InaccessibleDatastore"]], ["QueryIORMConfigOption", "QueryIORMConfigOption", "vim.version.version6", [["host", "vim.HostSystem", "vim.version.version6", {}, nil]], [{}, "vim.StorageResourceManager.IORMConfigOption", "vim.StorageResourceManager.IORMConfigOption"], "Datastore.Config", nil], ["applyRecommendationToPod", "ApplyStorageDrsRecommendationToPod_Task", "vim.version.version7", [["pod", "vim.StoragePod", "vim.version.version7", {}, nil], ["key", "string", "vim.version.version7", {}, nil]], [{}, "vim.Task", "vim.storageDrs.ApplyRecommendationResult"], "System.View", nil], ["applyRecommendation", "ApplyStorageDrsRecommendation_Task", "vim.version.version7", [["key", "string[]", "vim.version.version7", {}, nil]], [{}, "vim.Task", "vim.storageDrs.ApplyRecommendationResult"], "System.View", nil], ["cancelRecommendation", "CancelStorageDrsRecommendation", "vim.version.version7", [["key", "string[]", "vim.version.version7", {}, nil]], [{}, "void", "void"], "System.View", nil], ["refreshRecommendation", "RefreshStorageDrsRecommendation", "vim.version.version7", [["pod", "vim.StoragePod", "vim.version.version7", {}, nil]], [{}, "void", "void"], "System.View", nil], ["configureStorageDrsForPod", "ConfigureStorageDrsForPod_Task", "vim.version.version7", [["pod", "vim.StoragePod", "vim.version.version7", {}, "StoragePod.Config"], ["spec", "vim.storageDrs.ConfigSpec", "vim.version.version7", {}, nil], ["modify", "boolean", "vim.version.version7", {}, nil]], [{}, "vim.Task", "void"], nil, nil], ["recommendDatastores", "RecommendDatastores", "vim.version.version7", [["storageSpec", "vim.storageDrs.StoragePlacementSpec", "vim.version.version7", {}, nil]], [{}, "vim.storageDrs.StoragePlacementResult", "vim.storageDrs.StoragePlacementResult"], "System.View", nil]])
Severity: Minor
Found in bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb and 3 other locations - About 15 mins to fix
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 1488..1488
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 1488..1488
bosh_vsphere_cpi/lib/ruby_vim_sdk/server_objects.rb on lines 1875..1875

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

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 get_server_name
        user_data = get_user_data
        unless user_data.has_key?("server") && user_data["server"].has_key?("name")
          raise LoadSettingsError, "Cannot get CloudStack server name from user data #{user_data.inspect}"
        end
Severity: Minor
Found in bosh_agent/lib/bosh_agent/infrastructure/cloudstack/registry.rb and 1 other location - About 15 mins to fix
bosh_agent/lib/bosh_agent/infrastructure/openstack/registry.rb on lines 68..73

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

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 reboot_vm(server_id)
      with_thread_name("reboot_vm(#{server_id})") do
        server = with_openstack { @openstack.servers.get(server_id) }
        cloud_error("Server `#{server_id}' not found") unless server

Severity: Minor
Found in bosh_openstack_cpi/lib/cloud/openstack/cloud.rb and 1 other location - About 15 mins to fix
bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb on lines 332..337

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

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