ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

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

  def schedule_edit
    assert_privileges("miq_report_schedule_edit")
    case params[:button]
    when "cancel"
      @schedule = MiqSchedule.find(session[:edit][:sched_id]) if session[:edit] && session[:edit][:sched_id]
Severity: Minor
Found in app/controllers/report_controller/schedules.rb - About 5 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 ReportDataTable has 135 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ReportDataTable = (props) => {
  const { perPageDefault, perPageOptions, reportType } = props;
  const initState = {
    ...initialState,
    pagination: {

File action-form.schema.js has 539 lines of code (exceeds 400 allowed). Consider refactoring.
Open

/* eslint-disable no-restricted-syntax */
import { componentTypes, validatorTypes } from '@data-driven-forms/react-form-renderer';
import {
  assignProfiles, findInitialValue, buildParentTypeOptions, buildSnapShotAgeOptions,
  buildInheritTagOptions, buildAlertOptions, buildRunAnsible, buildTags,
Severity: Major
Found in app/javascript/components/action-form/action-form.schema.js - About 5 hrs to fix

Class ReportController has 40 methods (exceeds 20 allowed). Consider refactoring.
Open

class ReportController < ApplicationController
  DEFAULT_SORT_COLUMN_NUMBER = 2
  DEFAULT_SORT_ORDER = "DESC".freeze

  include Dashboards
Severity: Minor
Found in app/controllers/report_controller.rb - About 5 hrs to fix

File expression.rb has 536 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module ApplicationController::Filter
  EXP_TODAY = "Today".freeze
  EXP_FROM = "FROM".freeze
  EXP_IS = "IS".freeze

Severity: Major
Found in app/controllers/application_controller/filter/expression.rb - About 5 hrs to fix

Method st_edit has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

  def st_edit
    assert_privileges(params[:id] ? 'catalogitem_edit' : 'catalogitem_new')

    # reset the active tree back to :sandt_tree, it was changed temporairly to display automate entry point tree in a popup div
    self.x_active_tree = 'sandt_tree'
Severity: Minor
Found in app/controllers/catalog_controller.rb - About 5 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 perf_util_summary_section has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

  def perf_util_summary_section(s)
    ss = []

    # Fill in the single day data from the timestamp report
    ts_rpt = @sb[:ts_rpt]
Severity: Minor
Found in app/controllers/application_controller/performance.rb - About 5 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 dialog_form_button_pressed has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

  def dialog_form_button_pressed
    case params[:button]
    when "cancel"
      return unless load_edit("dialog_edit__#{params[:id]}", "replace_cell__explorer")

Severity: Minor
Found in app/controllers/application_controller/dialog_runner.rb - About 5 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 x_button has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

  def x_button
    model, action = pressed2model_action(params[:pressed])
    allowed_models = %w[common image instance vm miq_template provider automation storage infra_networking]
    raise ActionController::RoutingError, 'Invalid button action' unless
      allowed_models.include?(model)
Severity: Minor
Found in app/controllers/application_controller/explorer.rb - About 5 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 view_to_hash has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

  def view_to_hash(view, fetch_data = false)
    root = {:head => [], :rows => []}

    has_checkbox = !@embedded && !@no_checkboxes

Severity: Minor
Found in app/controllers/application_controller.rb - About 5 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 move_cols_left has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

  def move_cols_left
    if params[:selected_fields].blank? || params[:selected_fields][0] == ""
      add_flash(_("No fields were selected to move up"), :error)
    elsif display_filter_contains?(params[:selected_fields])
      add_flash(_("No fields were moved up"), :error)
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 5 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 show_saved_report has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

  def show_saved_report(id)
    rr = MiqReportResult.for_user(current_user).find(id)
    if rr.nil? # Saved report no longer exists
      @report = nil
      return
Severity: Minor
Found in app/controllers/report_controller/saved_reports.rb - About 5 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

File miq_request_controller.rb has 524 lines of code (exceeds 400 allowed). Consider refactoring.
Open

class MiqRequestController < ApplicationController
  include Mixins::GenericSessionMixin
  include Mixins::BreadcrumbsMixin

  before_action :check_privileges, :except => :post_install_callback
Severity: Major
Found in app/controllers/miq_request_controller.rb - About 5 hrs to fix

Method ap_edit has 123 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def ap_edit
    assert_privileges("ap_edit")
    if params["accept"]
      ap_accept_line_changes
    else
Severity: Major
Found in app/controllers/ops_controller/settings/analysis_profiles.rb - About 4 hrs to fix

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

  def replace_right_cell(options = {})
    action, replace_trees, presenter = options.values_at(:action, :replace_trees, :presenter)
    @explorer = true

    # FIXME: make this functional
Severity: Major
Found in app/controllers/catalog_controller.rb - About 4 hrs to fix

Function taggingMiddleware has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

export const taggingMiddleware = (store) => (next) => (action) => {
  let selected;

  const { type, meta, tag } = action;
  if (meta && meta.url) {
Severity: Minor
Found in app/javascript/miq-redux/middleware.js - 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 perf_util_daily_gen_data has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

  def perf_util_daily_gen_data(_refresh = nil)
    @perf_record ||= @record
    @sb[:summary] = nil # Clear out existing summary report
    @sb[:trend_charts] = nil # Clear out the charts to be generated

Severity: Minor
Found in app/controllers/application_controller/performance.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 process_changed_expression has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    def process_changed_expression(params, chosen_key, exp_key, exp_value, exp_valx)
      # Remove the second exp_value if the operator changed from EXP_FROM
      self[exp_value].delete_at(1) if self[exp_key] == EXP_FROM

      # Set THROUGH value if changing to FROM
Severity: Minor
Found in app/controllers/application_controller/filter/expression.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 rbac_edit_save_or_add has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

  def rbac_edit_save_or_add(what, rbac_suffix = what)
    key         = what.to_sym
    id          = params[:id] || "new"
    add_pressed = params[:button] == "add"

Severity: Minor
Found in app/controllers/ops_controller/ops_rbac.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 button has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

  def button
    @edit = session[:edit] # Restore @edit for adv search box
    params[:display] = @display if %w[all_vms vms hosts].include?(@display) # Were we displaying vms or hosts

    if params[:pressed].starts_with?("vm_", # Handle buttons from sub-items screen
Severity: Minor
Found in app/controllers/storage_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

Severity
Category
Status
Source
Language