ManageIQ/manageiq-ui-classic

View on GitHub
app/helpers/application_helper/toolbar/ansible_credentials_center.rb

Summary

Maintainability
A
2 hrs
Test Coverage
A
100%

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

  button_group('embedded_ansible_credentials', [
    select(
      :embedded_ansible_credentials_configuration,
      nil,
      t = N_('Configuration'),
app/helpers/application_helper/toolbar/workflow_credentials_center.rb on lines 2..50

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

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

  button_group('embedded_ansible_credentials_policy', [
                 select(
                   :embedded_ansible_credentials_policy_choice,
                   nil,
                   t = N_('Policy'),
app/helpers/application_helper/toolbar/ansible_playbooks_center.rb on lines 2..23
app/helpers/application_helper/toolbar/ansible_repositories_center.rb on lines 69..90
app/helpers/application_helper/toolbar/auth_key_pair_clouds_center.rb on lines 44..64
app/helpers/application_helper/toolbar/availability_zones_center.rb on lines 2..22
app/helpers/application_helper/toolbar/cloud_networks_center.rb on lines 22..44
app/helpers/application_helper/toolbar/cloud_object_store_containers_center.rb on lines 48..68
app/helpers/application_helper/toolbar/cloud_object_store_objects_center.rb on lines 28..48
app/helpers/application_helper/toolbar/cloud_subnets_center.rb on lines 41..62
app/helpers/application_helper/toolbar/cloud_tenants_center.rb on lines 37..57
app/helpers/application_helper/toolbar/cloud_volume_backups_center.rb on lines 34..54
app/helpers/application_helper/toolbar/cloud_volume_snapshots_center.rb on lines 30..50
app/helpers/application_helper/toolbar/cloud_volume_types_center.rb on lines 2..23
app/helpers/application_helper/toolbar/configuration_jobs_center.rb on lines 33..53
app/helpers/application_helper/toolbar/configuration_scripts_center.rb on lines 22..43
app/helpers/application_helper/toolbar/container_builds_center.rb on lines 2..22
app/helpers/application_helper/toolbar/container_image_registries_center.rb on lines 2..22
app/helpers/application_helper/toolbar/container_projects_center.rb on lines 2..22
app/helpers/application_helper/toolbar/container_routes_center.rb on lines 2..22
app/helpers/application_helper/toolbar/container_services_center.rb on lines 2..22
app/helpers/application_helper/toolbar/container_templates_center.rb on lines 2..22
app/helpers/application_helper/toolbar/containers_center.rb on lines 2..22
app/helpers/application_helper/toolbar/ems_clouds_center.rb on lines 89..109
app/helpers/application_helper/toolbar/ems_containers_center.rb on lines 101..121
app/helpers/application_helper/toolbar/ems_infras_center.rb on lines 89..109
app/helpers/application_helper/toolbar/ems_physical_infras_center.rb on lines 88..108
app/helpers/application_helper/toolbar/ems_storages_center.rb on lines 84..105
app/helpers/application_helper/toolbar/flavors_center.rb on lines 31..51
app/helpers/application_helper/toolbar/floating_ips_center.rb on lines 42..64
app/helpers/application_helper/toolbar/generic_objects_center.rb on lines 2..23
app/helpers/application_helper/toolbar/host_aggregates_center.rb on lines 56..76
app/helpers/application_helper/toolbar/infra_networkings_center.rb on lines 2..22
app/helpers/application_helper/toolbar/network_ports_center.rb on lines 2..22
app/helpers/application_helper/toolbar/network_routers_center.rb on lines 47..69
app/helpers/application_helper/toolbar/orchestration_stacks_center.rb on lines 22..42
app/helpers/application_helper/toolbar/orchestration_templates_center.rb on lines 47..67
app/helpers/application_helper/toolbar/persistent_volumes_center.rb on lines 2..22
app/helpers/application_helper/toolbar/security_groups_center.rb on lines 42..62
app/helpers/application_helper/toolbar/servicetemplates_center.rb on lines 64..84
app/helpers/application_helper/toolbar/storages_center.rb on lines 34..54
app/helpers/application_helper/toolbar/workflow_credentials_center.rb on lines 51..72
app/helpers/application_helper/toolbar/workflow_repositories_center.rb on lines 76..99

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

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