ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method rbac_role_info_view has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def rbac_role_info_view(role, rbac_menu_tree)
    rows = [
      row_data(_('ID'), role.id),
      row_data(_('Name'), role.name),
      row_data(_("Access Restriction for Orchestration Stacks, Key Pairs, Services, VMs, and Templates"), role.settings.kind_of?(Hash) && role.settings.fetch_path(:restrictions, :vms) ? _(MiqUserRole::RESTRICTIONS[role.settings.fetch_path(:restrictions, :vms)]) : _("None")),
Severity: Minor
Found in app/helpers/ops_helper/role_rbac_details_helper.rb - About 25 mins 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_record has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_record(db)
    if db == "host"
      @host = @record = identify_record(params[:id], Host)
    elsif db == "miq_template"
      @miq_template = @record = identify_record(params[:id], MiqTemplate)
Severity: Minor
Found in app/controllers/application_controller/ci_processing.rb - About 25 mins 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_show_list_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def process_show_list_options(options, curr_model = nil)
    @report_data_additional_options = ApplicationController::ReportDataAdditionalOptions.from_options(options)
    @report_data_additional_options.with_quadicon_options(
      :embedded   => @embedded,
      :showlinks  => @showlinks,
Severity: Minor
Found in app/helpers/application_helper.rb - About 25 mins 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 account_policy_details has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def account_policy_details
    policies = []
    if @record.operating_system.present?
      policies = {:pw_hist => _("Password History"), :max_pw_age => _("Max Password Age"),
                  :min_pw_age => _("Min Password Age"), :min_pw_len => _("Min Password Length"),
Severity: Minor
Found in app/helpers/textual_mixins/textual_os_info.rb - About 25 mins 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_element_destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def process_element_destroy(element, klass, name)
    return unless element.respond_to?(:destroy)

    audit = {:event        => "#{klass.name.downcase}_record_delete",
             :message      => "[#{name}] Record deleted",
Severity: Minor
Found in app/controllers/application_controller/ci_processing.rb - About 25 mins 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 comp_add_record_field_compressed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def comp_add_record_field_compressed(view, section, record, field)
    row = {}
    base_rec = view.results.fetch_path(view.ids[0], section[:name], record)

    view.ids.each_with_index do |id, idx|
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 25 mins 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_pre_prov_vars has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def set_pre_prov_vars
    @layout = "miq_request_vm"
    @edit = {}
    @edit[:explorer] = @explorer
    @edit[:vm_sortdir] ||= "ASC"
Severity: Minor
Found in app/controllers/application_controller/miq_request_methods.rb - About 25 mins 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 log_data_size has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def log_data_size(el, value, indent)
    indentation = '  ' * indent
    val_size = if value.kind_of?(Hash) || value.kind_of?(Array) || value.kind_of?(ActiveRecord::Base) || !value.respond_to?("size")
                 Marshal.dump(value).size
               else
Severity: Minor
Found in app/controllers/application_controller/session_size.rb - About 25 mins 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 drift_add_header has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def drift_add_header(view)
    row = []
    rowtemp = {
      :id    => "col0",
      :name  => "",
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 25 mins 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 comp_add_record_field_expanded has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def comp_add_record_field_expanded(view, section, record, field)
    row = {}
    base_rec = view.results.fetch_path(view.ids[0], section[:name], record)

    view.ids.each_with_index do |id, idx|
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 25 mins 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 column_names_for_compare_or_drift_report has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def column_names_for_compare_or_drift_report(mode)
    # Collect the column names from the @compare object
    column_names = ["Section", "Entry", "Sub-Entry"]

    if mode == :compare
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 25 mins 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_start_end has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def update_start_end(sdate, edate)
      if !sdate.nil? && !edate.nil?
        self.start = [sdate.year.to_s, (sdate.month - 1).to_s, sdate.day.to_s].join(", ")
        self.end = [edate.year.to_s, (edate.month - 1).to_s, edate.day.to_s].join(", ")
        self.end_date ||= [edate.month, edate.day, edate.year].join("/")
Severity: Minor
Found in app/controllers/application_controller/timelines/options.rb - About 25 mins 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_vm_grid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def build_vm_grid(vms, sort_order = nil, sort_by = nil, filter_by = nil)
    sort_by ||= "name"
    sort_order ||= "ASC"
    filter_by ||= ->(_) { true }

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

  def compare_miq(_db = nil)
    @compressed = session[:miq_compressed]
    @exists_mode = session[:miq_exists_mode]
    if @compare.nil? # == nil
      compare_init("compare") # Init compare screen variables
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 25 mins 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 identify_obj has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def identify_obj
    @drift_obj = nil
    begin
      db = @sb[:compare_db].constantize
      @record = @drift_obj = if @sb[:compare_db] == "Host"
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 25 mins 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 join_binary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def join_binary(exp, operation, color)
    ViewHelper.capture do
      ViewHelper.concat_tag(:font, :color => color) do
        ViewHelper.content_tag(:strong, '(')
      end
Severity: Minor
Found in app/controllers/application_controller/expression_html.rb - About 25 mins 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 drift_record_data_cols has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def drift_record_data_cols(view, section, record)
    row = {}
    last_value = false # Init base value
    match = 0
    view.ids.each_with_index do |id, idx| # Go thru all of the objects
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 25 mins 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 comp_add_header has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def comp_add_header(view)
    row = []
    rowtemp = {
      :id    => "col0",
      :name  => "",
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 25 mins 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_up has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def move_cols_up
    if params[:selected_fields].blank? || params[:selected_fields][0] == ""
      add_flash(_("No fields were selected to move up"), :error)
      return
    end
Severity: Minor
Found in app/controllers/application_controller/buttons.rb - About 25 mins 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 default_node has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def default_node
    return unless x_node == "root"

    options = {:model => "Switch", :named_scope => :shareable}
    process_show_list(options) if @show_list
Severity: Minor
Found in app/controllers/infra_networking_controller.rb - About 25 mins 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