ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

File miq_alert_controller.rb has 632 lines of code (exceeds 400 allowed). Consider refactoring.
Open

class MiqAlertController < ApplicationController
  before_action :check_privileges
  before_action :get_session_data
  after_action :cleanup_action
  after_action :set_session_data
Severity: Major
Found in app/controllers/miq_alert_controller.rb - About 7 hrs to fix

Function retirementTabSchema has 189 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const retirementTabSchema = (
  repositories,
  setData,
  retirementRepositoryId,
  currentRegion,

Function provisionTabSchema has 189 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const provisionTabSchema = (
  repositories,
  setData,
  provisionRepositoryId,
  currentRegion,

Method build_grid has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

  def build_grid
    case @edit[:wf]
    when MiqProvisionConfiguredSystemWorkflow
      build_dialog_page_miq_provision_configured_system_workflow
    when MiqProvisionVirtWorkflow
Severity: Minor
Found in app/controllers/application_controller/miq_request_methods.rb - About 7 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 ap_get_form_vars has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

  def ap_get_form_vars
    @scan = @edit[:scan_id] ? ScanItemSet.find(@edit[:scan_id]) : ScanItemSet.new
    @edit[:new][:name]        = params[:name]        if params[:name]
    @edit[:new][:description] = params[:description] if params[:description]

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

  def list_child_vms(model, node_id, title, show_list)
    options = {
      :model       => model,
      :named_scope => scopes_for_role,
    }
Severity: Minor
Found in app/controllers/vm_common.rb - About 7 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 action_field_changed has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

  def action_field_changed
    return unless load_edit("miq_action_edit__#{params[:id]}")

    @action = @edit[:action_id] ? MiqAction.find(@edit[:action_id]) : MiqAction.new

Severity: Minor
Found in app/controllers/miq_action_controller.rb - About 7 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 update_from_expression_editor has 176 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def update_from_expression_editor(params)
      if params[:chosen_typ] && params[:chosen_typ] != exp_typ
        change_exp_typ(params[:chosen_typ])
      else
        case exp_typ
Severity: Major
Found in app/controllers/application_controller/filter/expression.rb - About 7 hrs to fix

Function actionsToFunction has 173 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  actionsToFunction: function() {
    var startEnd = function(pageNumber) {
      var start = (pageNumber - 1) * this.settings.perpage;
      var end = start + this.settings.perpage;
      return {
Severity: Major
Found in app/javascript/oldjs/miq_qe.js - About 6 hrs to fix

Function processReplaceRightCell has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

ManageIQ.explorer.processReplaceRightCell = function(data) {
  /* variables for the expression editor */
  if (_.isObject(data.expEditor)) {
    if (_.isObject(data.expEditor.first)) {
      if (!_.isUndefined(data.expEditor.first.type)) {
Severity: Minor
Found in app/javascript/oldjs/miq_explorer.js - About 6 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 at_tree_select_toggle has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

  def at_tree_select_toggle(type, edit_key)
    automation_type = params[:automation_type] || default_entry_point_type

    if edit_key
      current_entry_point = @edit[:new][edit_key] # before updating @edit varibale.
Severity: Minor
Found in app/helpers/automate_tree_helper.rb - About 6 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_method_form_vars has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

  def get_method_form_vars
    @ae_method = @edit[:ae_method_id] ? MiqAeMethod.find(@edit[:ae_method_id]) : MiqAeMethod.new
    @in_a_form = true
    if params[:item].blank? && params[:button] != "accept" && params["action"] != "field_delete"
      # for method_inputs view
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 6 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_group_get_form_vars has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

  def rbac_group_get_form_vars
    if %w[up down].include?(params[:button])
      move_cols_up   if params[:button] == "up"
      move_cols_down if params[:button] == "down"
    else
Severity: Minor
Found in app/controllers/ops_controller/ops_rbac.rb - About 6 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_right_cell_vars has 172 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def set_right_cell_vars(options = {})
    name = @record.try(:name).to_s
    table = request.parameters["controller"]
    case @sb[:action]
    when "attach"
Severity: Major
Found in app/controllers/vm_common.rb - About 6 hrs to fix

Method set_form_vars has 172 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def set_form_vars
    @edit = {}
    @edit[:rpt_id] = @rpt.id # Save a record id to use it later to look a record
    @edit[:rpt_title] = @rpt.title
    @edit[:rpt_name] = @rpt.name
Severity: Major
Found in app/controllers/report_controller/reports/editor.rb - About 6 hrs to fix

Method update_from_exp_tree has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

    def update_from_exp_tree(exp)
      exp.delete(:token)
      key = exp.keys.first
      if exp[key]['field']
        typ = 'field'
Severity: Minor
Found in app/controllers/application_controller/filter/expression.rb - About 6 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 add_field_to_col_order has a Cognitive Complexity of 44 (exceeds 5 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: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 6 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 playbookReusableCodeMixin has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

function playbookReusableCodeMixin(API, $q, miqService) {
  var sortOptions = '&sort_by=name&sort_order=ascending';
  var allApiPromises = [];

  var getSortedHash = function(inputHash) {
Severity: Minor
Found in app/javascript/oldjs/controllers/playbook-reusable-code-mixin.js - About 6 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 db_edit has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

  def db_edit
    assert_privileges("db_edit")

    case params[:button]
    when "cancel"
Severity: Minor
Found in app/controllers/report_controller/dashboards.rb - About 6 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 RoutersForm has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

const RoutersForm = ({ routerId }) => {
  const [{
    initialValues, isLoading, fields, subnets,
  }, setState] = useState({
    isLoading: !!routerId, fields: [], subnetSelect: [], subnets: [],
Severity: Minor
Found in app/javascript/components/routers-form/index.jsx - About 6 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