ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method data_for_breadcrumbs has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
Open

    def data_for_breadcrumbs(controller_options = {})
      options = breadcrumbs_options || {}
      options[:record_info] ||= (@record || {})
      options[:record_title] ||= :name
      options[:not_tree] ||= false
Severity: Minor
Found in app/controllers/mixins/breadcrumbs_mixin.rb - About 1 day 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 270 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

      params[:display] = @display if ["vms", "hosts", 'host_aggregates', "storages", "instances", "images", "orchestration_stacks"].include?(@display) # Were we displaying vms/hosts/storages
      params[:page] = @current_page unless @current_page.nil? # Save current page for list refresh
Severity: Major
Found in app/controllers/mixins/ems_common.rb - About 1 day to fix

Function aeMethodFormController has 268 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function aeMethodFormController($http, $scope, aeMethodFormId, currentRegion, miqService, playbookReusableCodeMixin, location, API) {
  var vm = this;
  var init = function() {
    vm.aeMethodModel = {
      name: '',
Severity: Major
Found in app/javascript/angular/miq_ae_class/ae_method_form_controller.js - About 1 day to fix

Method set_form_locals has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
Open

  def set_form_locals
    locals = {}
    if x_active_tree == :diagnostics_tree
      if @sb[:active_tab] == "diagnostics_cu_repair"
        action_url = "cu_repair"
Severity: Minor
Found in app/controllers/ops_controller.rb - About 1 day 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 valid_report? has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
Open

  def valid_report?(rpt)
    active_tab = 'edit_1'
    if @edit[:new][:model] == ApplicationController::TREND_MODEL
      unless @edit[:new][:perf_trend_col]
        add_flash(_('Trending for is required'), :error)
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 1 day 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 alert_field_changed has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
Open

  def alert_field_changed
    return unless load_edit("miq_alert_edit__#{params[:id]}")

    @alert = @edit[:alert_id] ? MiqAlert.find(@edit[:alert_id]) : MiqAlert.new

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

  def widget_set_form_vars
    @timezone_abbr = get_timezone_abbr
    @edit = {}
    @edit[:widget_id] = @widget.id
    @edit[:read_only] = !!@widget.read_only
Severity: Minor
Found in app/controllers/report_controller/widgets.rb - About 1 day 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 ops_controller.rb has 743 lines of code (exceeds 400 allowed). Consider refactoring.
Open

class OpsController < ApplicationController
  # Methods for accordions
  include Diagnostics
  include OpsRbac
  include Settings
Severity: Major
Found in app/controllers/ops_controller.rb - About 1 day to fix

Method gfv_sort has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
Open

  def gfv_sort
    @edit[:new][:order] = params[:sort_order] if params[:sort_order]
    if params[:sort_group] # If grouping changed,
      @edit[:new][:group] = params[:sort_group]
      @refresh_div = "sort_div" # Resend the sort tab
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 1 day 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 252 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  var getSortedHash = function(inputHash) {
Severity: Major
Found in app/javascript/oldjs/controllers/playbook-reusable-code-mixin.js - About 1 day to fix

Method set_form_vars has a Cognitive Complexity of 63 (exceeds 5 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: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 1 day 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 alert_valid_record? has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

  def alert_valid_record?(alert)
    if alert.expression.nil?
      add_flash(_("A valid expression must be present"), :error)
    end
    unless display_driving_event?
Severity: Minor
Found in app/controllers/miq_alert_controller.rb - About 1 day 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 createSchema has 245 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const createSchema = (state, setState, ems, initialValues, storageId, setStorageId) => {
  let emsId = state.ems_id;
  if (initialValues && initialValues.ems_id) {
    emsId = initialValues.ems_id;
  }

Method perf_gen_charts has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

  def perf_gen_charts(rpt, perf_options, parent = false)
    model_title = parent ? "Parent-#{perf_options[:parent]}" : perf_options[:model]
    charts = []
    chart_data = []
    case perf_options[:typ]
Severity: Minor
Found in app/controllers/application_controller/performance.rb - About 1 day 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 addSchema has 237 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const addSchema = (formValues) => {
  const basicOptions = generateBasicOptions();
  const rangeNine = generateRange(10);
  const rangeFour = generateRange(5);
  const rangeFive = generateRange(6);
Severity: Major
Found in app/javascript/components/workers-form/workers.schema.js - About 1 day to fix

Method workflow_instance_from_vars has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
Open

  def workflow_instance_from_vars(req)
    options         = {}
    pre_prov_values = nil
    if %w[miq_template service_template vm].include?(@edit[:org_controller])
      if params[:prov_type] && !req # only do this new requests
Severity: Minor
Found in app/controllers/application_controller/miq_request_methods.rb - About 1 day 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 has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

  def show(id = nil)
    @flash_array = [] if params[:display] && params[:display] != "snapshot_info"
    @sb[:action] = params[:display]

    return if perfmenu_click?
Severity: Minor
Found in app/controllers/vm_common.rb - About 1 day 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 diagnostics_set_form_vars has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

  def diagnostics_set_form_vars
    active_node = x_node
    if active_node && active_node.split('-').first == "z"
      @record = @selected_server = Zone.find_by(:id => active_node.split('-').last)
      @sb[:selected_server_id] = @selected_server.id
Severity: Minor
Found in app/controllers/ops_controller/diagnostics.rb - About 1 day 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_global_session_data has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

  def set_global_session_data
    @sb ||= {}
    # Set all of the global variables used by most of the controllers
    session[:layout] = @layout
    session[:panels] = @panels
Severity: Minor
Found in app/controllers/application_controller.rb - About 1 day 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 prov_set_form_vars has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

  def prov_set_form_vars(req = nil)
    @edit ||= {}
    session[:prov_options]      = @options = nil  # Clearing out options that were set on show screen
    @edit[:req_id]              = req.try(:id)    # Save existing request record id, if passed in
    @edit[:key]                 = "prov_edit__#{@edit[:req_id] || "new"}"
Severity: Minor
Found in app/controllers/application_controller/miq_request_methods.rb - About 1 day 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