ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

Method create_action_url has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create_action_url(node)
    if @sb[:action] == "miq_ae_domain_priority_edit"
      'domains_priority_edit'
    elsif @sb[:action] == 'miq_ae_field_seq'
      'fields_seq_edit'
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr to fix

Method copy_save has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def copy_save
    assert_privileges(feature_by_action)
    return unless load_edit("copy_objects__#{params[:id]}", "replace_cell__explorer")

    begin
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr to fix

Method fields_set_form_vars has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def fields_set_form_vars
    @in_a_form_fields = true
    session[:field_data] = {}
    @edit = {
      :ae_class_id      => @ae_class.id,
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr to fix

Method replace_right_cell has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def replace_right_cell(_nodetype)
    # Get the tags for this node for the Classification pulldown
    @sb[:tags] = nil unless params[:miq_date_1] || params[:miq_date_2] # Clear tags unless just changing date
    unless @nodetype == "h" || @nodetype == "s" || params[:miq_date_1] || params[:miq_date_2] # Get the tags for the pulldown, unless host, storage, or just changing the date
      if @sb[:options][:chart_date]
Severity: Minor
Found in app/controllers/utilization_controller.rb - About 1 hr to fix

Method button has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def button
      @edit = session[:edit] # Restore @edit for adv search box
      params[:display] = @display if ["#{params[:controller]}s"].include?(@display) # displaying container_*
      params[:page] = @current_page if @current_page.nil? # Save current page for list refresh

Severity: Minor
Found in app/controllers/mixins/containers_common_mixin.rb - About 1 hr to fix

Method update has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def update
    assert_privileges("cloud_volume_edit")
    @volume = find_record_with_rbac(CloudVolume, params[:id])

    case params[:button]
Severity: Minor
Found in app/controllers/cloud_volume_controller.rb - About 1 hr to fix

Method replace_list_grid has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def replace_list_grid
    view = @view
    button_div = 'center_tb'
    action_url = if @lastaction == "scan_history"
                   "scan_history"
Severity: Minor
Found in app/controllers/application_controller.rb - About 1 hr to fix

Method gfv_model has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def gfv_model
    if params[:chosen_model] && # Check for db table changed
       params[:chosen_model] != @edit[:new][:model]
      @edit[:new][:model] = params[:chosen_model]
      @edit[:new][:perf_interval] = nil                         # Clear performance interval setting
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 1 hr to fix

Method get_node_info has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def get_node_info(treenodeid, _show_list = true)
    @explorer ||= true
    @nodetype, id = parse_nodetype_and_id(valid_active_node(treenodeid))
    # saving this so it can be used while adding buttons/groups in buttons editor
    @sb[:applies_to_id] = id
Severity: Minor
Found in app/controllers/catalog_controller.rb - About 1 hr to fix

Method db_available_widgets_options has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def db_available_widgets_options
    # Build the available widgets for the pulldown
    col_widgets = @edit[:new][:col1] +
                  @edit[:new][:col2]
    if @sb[:nodes].length == 2 && @sb[:nodes][1] != "g"
Severity: Minor
Found in app/controllers/report_controller/dashboards.rb - About 1 hr to fix

Method get_all_reps has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def get_all_reps(nodeid = nil)
    # set nodeid from @sb, incase sort was pressed
    nodeid = x_active_tree == :reports_tree ? x_node.split('-').last : x_node.split('-').last.split('_')[0] if nodeid.nil?
    @sb[:miq_report_id] = nodeid
    @record = @miq_report = MiqReport.for_user(current_user).find(@sb[:miq_report_id])
Severity: Minor
Found in app/controllers/report_controller/reports.rb - About 1 hr to fix

Method delete_cloud_tenants has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def delete_cloud_tenants
    assert_privileges("cloud_tenant_delete")
    tenants = find_records_with_rbac(CloudTenant, checked_or_params)
    tenants_to_delete = []
    tenants.each do |tenant|
Severity: Minor
Found in app/controllers/cloud_tenant_controller.rb - About 1 hr to fix

Method heatmaps_data has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def heatmaps_data(metrics)
    node_cpu_usage = []
    node_memory_usage = []

    metrics.each do |m|
Severity: Minor
Found in app/services/container_dashboard_service.rb - About 1 hr to fix

Method notification_data has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def notification_data(components, component_type)
    if components&.first.respond_to?(:health_state)
      count = 0
      health_states = components.each_with_object({}) do |component, health_state|
        health_state[component.health_state&.downcase] = (health_state[component.health_state&.downcase] || 0) + 1
Severity: Minor
Found in app/services/ems_physical_infra_dashboard_service.rb - About 1 hr to fix

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

  def process_floating_ips(floating_ips, operation)
    return if floating_ips.empty?

    if operation == "destroy"
      floating_ips.each do |floating_ip|
Severity: Major
Found in app/controllers/floating_ip_controller.rb and 6 other locations - About 1 hr to fix
app/controllers/cloud_network_controller.rb on lines 219..236
app/controllers/cloud_object_store_container_controller.rb on lines 109..126
app/controllers/cloud_tenant_controller.rb on lines 137..154
app/controllers/cloud_volume_snapshot_controller.rb on lines 67..84
app/controllers/network_router_controller.rb on lines 281..298
app/controllers/security_group_controller.rb on lines 281..298

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

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

  def process_cloud_networks(networks, operation)
    return if networks.empty?

    if operation == "destroy"
      networks.each do |network|
Severity: Major
Found in app/controllers/cloud_network_controller.rb and 6 other locations - About 1 hr to fix
app/controllers/cloud_object_store_container_controller.rb on lines 109..126
app/controllers/cloud_tenant_controller.rb on lines 137..154
app/controllers/cloud_volume_snapshot_controller.rb on lines 67..84
app/controllers/floating_ip_controller.rb on lines 149..166
app/controllers/network_router_controller.rb on lines 281..298
app/controllers/security_group_controller.rb on lines 281..298

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

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

  def process_cloud_tenants(tenants, task)
    return if tenants.empty?

    if task == "destroy"
      tenants.each do |tenant|
Severity: Major
Found in app/controllers/cloud_tenant_controller.rb and 6 other locations - About 1 hr to fix
app/controllers/cloud_network_controller.rb on lines 219..236
app/controllers/cloud_object_store_container_controller.rb on lines 109..126
app/controllers/cloud_volume_snapshot_controller.rb on lines 67..84
app/controllers/floating_ip_controller.rb on lines 149..166
app/controllers/network_router_controller.rb on lines 281..298
app/controllers/security_group_controller.rb on lines 281..298

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

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

  def process_cloud_volume_snapshots(snapshots, task)
    return if snapshots.empty?

    if task == "destroy"
      snapshots.each do |snapshot|
Severity: Major
Found in app/controllers/cloud_volume_snapshot_controller.rb and 6 other locations - About 1 hr to fix
app/controllers/cloud_network_controller.rb on lines 219..236
app/controllers/cloud_object_store_container_controller.rb on lines 109..126
app/controllers/cloud_tenant_controller.rb on lines 137..154
app/controllers/floating_ip_controller.rb on lines 149..166
app/controllers/network_router_controller.rb on lines 281..298
app/controllers/security_group_controller.rb on lines 281..298

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

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

  def process_network_routers(routers, operation)
    return if routers.empty?

    if operation == "destroy"
      routers.each do |router|
Severity: Major
Found in app/controllers/network_router_controller.rb and 6 other locations - About 1 hr to fix
app/controllers/cloud_network_controller.rb on lines 219..236
app/controllers/cloud_object_store_container_controller.rb on lines 109..126
app/controllers/cloud_tenant_controller.rb on lines 137..154
app/controllers/cloud_volume_snapshot_controller.rb on lines 67..84
app/controllers/floating_ip_controller.rb on lines 149..166
app/controllers/security_group_controller.rb on lines 281..298

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

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

  def process_cloud_object_store_container(containers, operation)
    return if containers.empty?

    if operation == "destroy"
      containers.each do |container|
Severity: Major
Found in app/controllers/cloud_object_store_container_controller.rb and 6 other locations - About 1 hr to fix
app/controllers/cloud_network_controller.rb on lines 219..236
app/controllers/cloud_tenant_controller.rb on lines 137..154
app/controllers/cloud_volume_snapshot_controller.rb on lines 67..84
app/controllers/floating_ip_controller.rb on lines 149..166
app/controllers/network_router_controller.rb on lines 281..298
app/controllers/security_group_controller.rb on lines 281..298

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

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