ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

Function notificationReducer has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const notificationReducer = (state = notificationInitialState, action) => {
  switch (action.type) {
    case INIT_NOTIFICATIONS:
      return {
        ...state,
Severity: Major
Found in app/javascript/miq-redux/notification-reducer.js - About 2 hrs to fix

Method ab_button_add has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def ab_button_add
    assert_privileges("ab_button_new")
    @sb[:active_tab] = "ab_options_tab"
    @resolve = session[:resolve]
    name = @edit[:new][:instance_name].presence || @edit[:new][:other_name]
Severity: Major
Found in app/controllers/application_controller/buttons.rb - About 2 hrs to fix

Method menu_update has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def menu_update
    assert_privileges("miq_report_menu_editor")

    menu_get_form_vars
    # @changed = (@edit[:new] != @edit[:current])
Severity: Major
Found in app/controllers/report_controller/menus.rb - About 2 hrs to fix

File quadicons.js has 419 lines of code (exceeds 400 allowed). Consider refactoring.
Open

export const quads = [
  {
    topLeft: {
      fonticon: 'fa fa-cog',
      color: '#0099cc',
Severity: Minor
Found in app/javascript/spec/quadicon/data/quadicons.js - About 2 hrs to fix

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

  recentServersConfig: {
    chartId: 'recentServersChart',
    tooltipFn: () => dailyTimeTooltip(),
    units: __('Servers'),
    point: { r: 1 },
app/javascript/components/provider-dashboard-charts/charts_config.js on lines 201..210
app/javascript/components/provider-dashboard-charts/charts_config.js on lines 211..220

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

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

  recentInstancesConfig: {
    chartId: 'recentInstancesChart',
    tooltipFn: () => dailyTimeTooltip(),
    units: __('Instances'),
    point: { r: 1 },
app/javascript/components/provider-dashboard-charts/charts_config.js on lines 191..200
app/javascript/components/provider-dashboard-charts/charts_config.js on lines 211..220

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

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

  recentImagesConfig: {
    chartId: 'recentInstancesChart',
    tooltipFn: () => dailyTimeTooltip(),
    units: __('Images'),
    point: { r: 1 },
app/javascript/components/provider-dashboard-charts/charts_config.js on lines 191..200
app/javascript/components/provider-dashboard-charts/charts_config.js on lines 201..210

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

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

  dailyNetworkUsageConfig: {
    chartId: 'networkUsageDailyChart',
    headTitle: __('Network Utilization Trend'),
    timeFrame: __('Last 30 Days'),
    units: __('KBps'),
app/javascript/components/provider-dashboard-charts/charts_config.js on lines 109..119

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

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

  hourlyNetworkUsageConfig: {
    chartId: 'networkUsageHourlyChart',
    headTitle: __('Network Utilization Trend'),
    timeFrame: __('Last 24 Hours'),
    units: __('KBps'),
app/javascript/components/provider-dashboard-charts/charts_config.js on lines 98..108

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

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

  API.get(`/api/vms/?filter[]=ems_id=${emsId}&expand=resources`)
    .then(({ resources }) => resources.filter((vm) => vm.id !== `${recordId}`))
    // Get valid VM Parent Options and format them for select component
    .then((vmParentOptions) => vmParentOptions.forEach((vm) => {
      parentOptions.push({ label: `${vm.name} -- ${vm.location}`, value: `${vm.id},${vm.template}` });
Severity: Major
Found in app/javascript/components/vm-edit-form/helper.js and 1 other location - About 2 hrs to fix
app/javascript/components/vm-edit-form/helper.js on lines 10..22

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

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

Function onSubmit has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const onSubmit = (values, formApi) => {
    promise.then(async({ data: { allowed_association_types } }) => {
      // check to determine whether to delete or replace existing custom image
      if (values.file_upload) {
        const fileList = get(values, formApi.fileInputs[0]).inputFiles;
Severity: Major
Found in app/javascript/components/generic-objects-form/index.jsx - About 2 hrs to fix

Function render has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const usedServicesMessage = (data) => {
      let warningItems = [];
      if (data.length === 1) { // We're deleting just one catalog item
        const services = {};
Severity: Major
Found in app/javascript/components/remove-catalog-item-modal.jsx - About 2 hrs to fix

Method pre_prov has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def pre_prov
    assert_privileges("miq_request_edit")
    if params[:button] == "cancel"
      flash_to_session(_("Add of new %{type} Request was cancelled by the user") % {:type => session[:edit][:prov_type]})
      @explorer = session[:edit][:explorer] || false
Severity: Major
Found in app/controllers/application_controller/miq_request_methods.rb - About 2 hrs to fix

Method miq_event_edit has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def miq_event_edit
    assert_privileges("miq_policy_event_edit")
    case params[:button]
    when "cancel"
      @edit = nil
Severity: Major
Found in app/controllers/miq_policy_controller/events.rb - About 2 hrs to fix

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

  def button
    @edit = session[:edit] # Restore @edit for adv search box

    params[:display] = @display if ["instances"].include?(@display) # Were we displaying vms/hosts/storages
    params[:page] = @current_page if @current_page.nil? # Save current page for list refresh
Severity: Major
Found in app/controllers/orchestration_stack_controller.rb - About 2 hrs to fix

Method old_dialogs_update_create has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def old_dialogs_update_create
    old_dialogs_get_form_vars
    case params[:button]
    when "cancel"
      @edit = session[:edit] = nil # clean out the saved info
Severity: Major
Found in app/controllers/miq_ae_customization_controller/old_dialogs.rb - About 2 hrs to fix

Method add_field_to_col_order has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def add_field_to_col_order(rpt, field)
    # Get the sort columns, removing the suffix if it exists
    sortby1 = if MiqReport.is_break_suffix?(@edit[:new][:sortby1].split("__")[1])
                @edit[:new][:sortby1].split("__").first
              else
Severity: Major
Found in app/controllers/report_controller/reports/editor.rb - About 2 hrs to fix

Method check_tabs has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def check_tabs
    @sb[:miq_tab] = params[:tab]
    active_tab = 'edit_1'
    case @sb[:miq_tab].split('_')[1]
    when '8'
Severity: Major
Found in app/controllers/report_controller/reports/editor.rb - About 2 hrs to fix

Method schedule_get_form_vars has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def schedule_get_form_vars
    @schedule = @edit[:sched_id] ? MiqSchedule.find(@edit[:sched_id]) : MiqSchedule.new(:userid => session[:userid])
    copy_params_if_present(@edit[:new], params, %i[name description])
    @edit[:new][:enabled] = (params[:enabled] == "1") if params[:enabled]
    @edit[:new][:filter] = params[:filter_typ] if params[:filter_typ]
Severity: Major
Found in app/controllers/report_controller/schedules.rb - About 2 hrs to fix

Method for_render_default has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def for_render_default
    data = {:explorer => 'replace_right_cell', :scrollTop => true}

    if @options[:exp].present?
      data.store_path(:expEditor, :first, :type,   @options[:exp][:val1_type]) if @options[:exp][:val1_type]
Severity: Major
Found in app/presenters/explorer_presenter.rb - About 2 hrs to fix
Severity
Category
Status
Source
Language