ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method exp_button has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  def exp_button
    @edit = session[:edit]
    case params[:pressed]
    when "undo", "redo"
      @edit[@expkey][:expression] = @edit[@expkey].history.rewind(params[:pressed])
Severity: Minor
Found in app/controllers/application_controller/filter.rb - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method schedule_edit has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  def schedule_edit
    assert_privileges("schedule_edit")
    case params[:button]
    when "cancel"
      @schedule = MiqSchedule.find_by(:id => params[:id])
Severity: Minor
Found in app/controllers/ops_controller/settings/schedules.rb - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method set_form_vars has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  def set_form_vars
    @edit = {
      :cb_rates  => {},
      :cb_assign => {},
    }
Severity: Minor
Found in app/controllers/chargeback_assignment_controller.rb - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method schedule_set_form_vars has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  def schedule_set_form_vars
    @timezone_abbr = get_timezone_abbr
    @edit = {}
    @folders = []

Severity: Minor
Found in app/controllers/report_controller/schedules.rb - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method settings_form_field_changed has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def settings_form_field_changed
    assert_privileges("ops_settings")

    settings_get_form_vars
    return unless @edit
Severity: Major
Found in app/controllers/ops_controller/settings/common.rb - About 4 hrs to fix

Function createSchema has 113 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createSchema(fieldss, recordId, emsId, mode, loadSchema, alertState, alertOptions) {
  let selectedOptions = []; // in edit form, selectedOptions are options that are passed in when open the form for first time
  let editSelectedOptions = []; // in edit form, editSelectedOptions recorded all the selected options once the form is changed
  let selectedOptionsChanged = false; // in edit form, selectedOptionsChanged changes to true once there is a change in selected options

Class ToolbarBuilder has 35 methods (exceeds 20 allowed). Consider refactoring.
Open

class ApplicationHelper::ToolbarBuilder
  include MiqAeClassHelper
  include RestfulControllerMixin
  include ApplicationHelper::Toolbar::Mixins::CustomButtonToolbarMixin

Severity: Minor
Found in app/helpers/application_helper/toolbar_builder.rb - About 4 hrs to fix

Class MiqTaskController has 35 methods (exceeds 20 allowed). Consider refactoring.
Open

class MiqTaskController < ApplicationController
  before_action :check_privileges
  before_action :get_session_data
  after_action :cleanup_action
  after_action :set_session_data
Severity: Minor
Found in app/controllers/miq_task_controller.rb - About 4 hrs to fix

Class MiqAeCustomizationController has 35 methods (exceeds 20 allowed). Consider refactoring.
Open

class MiqAeCustomizationController < ApplicationController
  require "English"
  include CustomButtons
  include OldDialogs
  include Dialogs
Severity: Minor
Found in app/controllers/miq_ae_customization_controller.rb - About 4 hrs to fix

Function createSchema has 111 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const createSchema = (fields, edit, ems, loadSchema, emptySchema) => {
  const idx = fields.findIndex((field) => field.name === 'required_capabilities');
  const supports = edit ? 'supports_storage_services' : 'supports_storage_service_create';
  let providerCapabilities;

Function MainMenu has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

export const MainMenu = ({
  applianceName,
  brandUrl,
  currentGroup,
  currentUser,
Severity: Minor
Found in app/javascript/menu/main-menu.jsx - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function DashboardWidget has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

const DashboardWidget = ({ data, id, title }) => {
  const convertedData = getConvertedData(data);
  let showLegend = true;
  const nameTable = data.miq.name_table;
  if (convertedData.length > 0 && data.miq) {

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method ap_ce_delete has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  def ap_ce_delete
    assert_privileges("ap_delete")

    return unless load_edit("ap_edit__#{params[:id]}", "replace_cell__explorer")

Severity: Minor
Found in app/controllers/ops_controller/settings/analysis_profiles.rb - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method settings_get_info has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  def settings_get_info(nodetype = x_node)
    nodes = nodetype.downcase.split("-")
    case nodes[0]
    when "root"
      @right_cell_text = _("%{product} Region \"%{name}\"") %
Severity: Minor
Found in app/controllers/ops_controller/settings/common.rb - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method build_search_filter_from_params has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  def build_search_filter_from_params(schedule, filter_type, value, other_value)
    resource_type = schedule.resource_type
    check_compliance = schedule&.sched_action&.dig(:method) == "check_compliance"
    filter_resource_type = if check_compliance
                             if resource_type == "ContainerImage"
Severity: Minor
Found in app/controllers/ops_controller/settings/schedules.rb - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method get_view_process_search_text has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  def get_view_process_search_text(view)
    # Check for new search by name text entered
    if params[:search]
      @search_text = params[:search][:text].blank? ? nil : params[:search][:text].strip
    elsif params[:search_text] && @explorer
Severity: Minor
Found in app/controllers/application_controller.rb - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function onClick has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

const onClick = (button) => {
  let buttonUrl;

  if (button.confirm && !window.confirm(button.confirm)) {
    // No handling unless confirmed.
Severity: Minor
Found in app/javascript/components/miq-toolbar.jsx - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method catalog_basic_information has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

  def catalog_basic_information(record, sb_params, tenants_tree)
    prov_types = catalog_provision_types
    prov_data = [prov_types[:template], prov_types[:ovf]].include?(record.prov_type) && (catalog_provision?(record, :playbook) || catalog_provision?(record, :terraform_template)) ? provisioning : nil
    data = {:title => _('Basic Information'), :mode => "miq_catalog_basic_information"}
    rows = []
Severity: Minor
Found in app/helpers/catalog_helper.rb - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method build_download_rpt has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

  def build_download_rpt(cols, csv, typ)
    if typ.nil? || typ == "all"
      if csv # If generating CSV, remove * from data
        cols.each_with_index do |c, i|
          if c.to_s.starts_with?("* ")
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method exp_add_joiner has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

  def exp_add_joiner(exp, token, joiner)
    if exp[:token] && exp[:token] == token                # If the token matches
      exp.keys.each do |key|                              # Find the key
        if key == :token
          exp.delete(key)                                 # Remove the :token key
Severity: Minor
Found in app/controllers/application_controller/filter.rb - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language