ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method find_includes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def find_includes(col, includes)
    tables = col.split(".")[0..-2]
    field = col.split(".").last

    table = tables.first
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 1 hr 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 explorer has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def explorer
    @explorer = true
    @lastaction      = "explorer"
    @ght_type        = nil
    @report          = nil
Severity: Minor
Found in app/controllers/report_controller.rb - About 1 hr 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 replace_gtl_main_div has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def replace_gtl_main_div(_options = {})
    return if params[:action] == "button" && @lastaction == "show"

    if @grid_hash
      # need to call this outside render :update
Severity: Minor
Found in app/controllers/application_controller.rb - About 1 hr 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 db_available_widgets_options has a Cognitive Complexity of 13 (exceeds 5 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

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 service_delete has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def service_delete
    assert_privileges("service_delete")
    elements = []
    if params[:id] # delete service from its details page
      elements.push(params[:id])
Severity: Minor
Found in app/controllers/service_controller.rb - About 1 hr 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 widget_form_field_changed has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def widget_form_field_changed
    assert_privileges(feature_for_widget_action)

    return unless load_edit("widget_edit__#{params[:id]}", "replace_cell__explorer")
    widget_get_form_vars
Severity: Minor
Found in app/controllers/report_controller/widgets.rb - About 1 hr 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 determine_api_endpoints has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def determine_api_endpoints(obj, display_options = {})
    base_name = obj.class.base_model.name
    case base_name
    when /EmsCluster/
      api_collection_name = "clusters"
Severity: Minor
Found in app/services/dialog_local_service.rb - About 1 hr 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 miq_tabs_init has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.miq_tabs_init = function(id, url, parms) {
  $(`${id} > ul.nav-tabs a[data-toggle="tab"]`).on('show.bs.tab', (e) => {
    if ($(e.target).parent().hasClass('disabled')) {
      e.preventDefault();
      return false;
Severity: Minor
Found in app/javascript/oldjs/miq_application.js - About 1 hr to fix

Function prepareRequestObject has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const prepareRequestObject = (values, formId) => {
  const requestObject = { ...values };

  // if price property is not there add price property if its present convert the value into string
  if (!Object.prototype.hasOwnProperty.call(requestObject, 'price')) {

Function createBackupSchema has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createBackupSchema() {
  const fields = [{
    component: componentTypes.SUB_FORM,
    title: __('Basic Information'),
    id: 'basic-information',

Function link has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    link: function(scope, _elem, attrs, ctrl) {
      ctrl.$parsers.push(function(value) {
        if (attrs.timeType === 'day' && value) {
          setAllDaysChecked(attrs.allTimeCheck, value);
        } else if (attrs.timeType === 'hour' && value) {
Severity: Minor
Found in app/javascript/oldjs/directives/configuration/all_time_check.js - About 1 hr to fix

Method miq_summary_policy_events has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def miq_summary_policy_events(policy_events, record)
    data = {:title => _("Events"), :mode => "miq_policy_events"}
    data[:headers] = [_('Description'), _('Actions')]
    rows = []
    if policy_events.empty?
Severity: Minor
Found in app/helpers/miq_policy_helper.rb - About 1 hr to fix

Method javascript_for_timer_type has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def javascript_for_timer_type(timer_type)
    case timer_type
    when "Monthly"
      [
        javascript_hide("weekly_span"),
Severity: Minor
Found in app/helpers/application_helper.rb - About 1 hr to fix

Method exp_token_pressed has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def exp_token_pressed
    @edit = session[:edit]
    token = params[:token].to_i
    if token == @edit[@expkey][:exp_token] || # User selected same token as already selected
       (@edit[@expkey][:exp_token] && @edit[:edit_exp].key?("???")) # or new token in process
Severity: Minor
Found in app/controllers/application_controller/filter.rb - About 1 hr to fix

Method miq_policy_edit_conditions has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def miq_policy_edit_conditions
    assert_privileges('miq_policy_conditions_assignment')
    case params[:button]
    when "cancel"
      @sb[:action] = @edit = nil
Severity: Minor
Found in app/controllers/miq_policy_controller/policies.rb - About 1 hr to fix

Method fields_form_field_changed has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def fields_form_field_changed
    assert_privileges('miq_ae_field_edit')
    return unless load_edit("aefields_edit__#{params[:id]}", "replace_cell__explorer")

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

Method rbac_get_info has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def rbac_get_info
    node, id = x_node.split("-")
    case node
    when "xx"
      case id
Severity: Minor
Found in app/controllers/ops_controller/ops_rbac.rb - About 1 hr to fix

Method gfv_trend has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def gfv_trend
    if params[:chosen_trend_col]
      @edit[:new][:perf_interval] ||= "daily" # Default to Daily
      @edit[:new][:perf_target_pct1] ||= 100  # Default to 100%
      if params[:chosen_trend_col] == "<Choose>"
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 1 hr to fix

Method alert_build_pulldowns has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def alert_build_pulldowns
    @sb[:alert] ||= {}

    # :event_types
    unless @sb[:alert][:events] # Only create this once
Severity: Minor
Found in app/controllers/miq_alert_controller.rb - About 1 hr to fix

Method attributes_data has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def attributes_data
    attributes = %i[physical_chassis
                    physical_racks
                    physical_servers
                    physical_storages
Severity: Minor
Found in app/services/ems_physical_infra_dashboard_service.rb - About 1 hr to fix
Severity
Category
Status
Source
Language