ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Avoid deeply nested control flow statements.
Open

      @visibility_expression_table = exp_build_table(@custom_button.visibility_expression.exp) if @custom_button.visibility_expression.kind_of?(MiqExpression)
Severity: Major
Found in app/controllers/miq_ae_customization_controller/custom_buttons.rb - About 45 mins to fix

Method show_association has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def show_association(action, display_name, method, klass, association = nil, scopes = nil)
Severity: Minor
Found in app/controllers/mixins/explorer_show.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

      button_order = @record[:set_data] && @record[:set_data][:button_order] ? @record[:set_data][:button_order] : nil
Severity: Major
Found in app/controllers/miq_ae_customization_controller/custom_buttons.rb - About 45 mins to fix

Method build_field_order has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def build_field_order
    @edit[:new][:field_order] = []
    @edit[:new][:fields].each do |f|
      if @edit[:new][:pivot] && @edit[:new][:pivot].by1 != ReportHelper::NOTHING_STRING && # If we are doing pivoting and
         @edit[:pivot_cols].key?(f.last) # this is a pivot calc column
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 45 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

Avoid deeply nested control flow statements.
Open

            @edit[:new][:sortby2] = field_key + (suffix2 ? "__#{suffix2}" : "") if col == sort2
Severity: Major
Found in app/controllers/report_controller/reports/editor.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    g[:scaling_max] = g[:scaling_min] if g[:scaling_max] < g[:scaling_min]
Severity: Major
Found in app/controllers/catalog_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                  template_locals.merge!(fetch_ovf_template_details) if need_ovf_template_locals?
Severity: Major
Found in app/controllers/catalog_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                  template_locals.merge!(fetch_terraform_template_details) if need_terraform_locals?
Severity: Major
Found in app/controllers/catalog_controller.rb - About 45 mins to fix

Method open_parent_nodes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def open_parent_nodes
    existing_node = nil
    nodes = params[:id].split('_')
    nodes.pop
    parents = []
Severity: Minor
Found in app/controllers/report_controller.rb - About 45 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

Avoid deeply nested control flow statements.
Open

      @edit[:new][:perf_target_pct3] = params[:percent3] == "<None>" ? nil : params[:percent3].to_i
Severity: Major
Found in app/controllers/report_controller/reports/editor.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

      presenter.replace(:flash_msg_div, r[:partial => "layouts/flash_msg"]) if @flash_array
Severity: Major
Found in app/controllers/report_controller.rb - About 45 mins to fix

Method task_supported has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def task_supported(typ)
    vms = find_records_with_rbac(VmOrTemplate, checked_or_params)
    if %w[migrate publish].include?(typ) && vms.any?(&:template?)
      render_flash_not_applicable_to_model(typ, ui_lookup(:table => "miq_template"))
      return
Severity: Minor
Found in app/controllers/application_controller.rb - About 45 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

Avoid deeply nested control flow statements.
Open

        if params[:break_format].blank? || # Remove format and col key (if empty)
           params[:break_format].to_sym == MiqReport.get_col_info(@edit[:new][:sortby1])[:default_format]
          if @edit[:new][:col_options][co_key1]
            @edit[:new][:col_options][co_key1].delete(:break_format)
            @edit[:new][:col_options].delete(co_key1) if @edit[:new][:col_options][co_key1].empty?
Severity: Major
Found in app/controllers/report_controller/reports/editor.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if param_value
                      p_index = @edit[:new][:rsc_groups].flatten.collect { |rg| rg[:provision_index].to_i }.sort

                      # if index that came in is being used more than once
                      if p_index.count(g[key]) > 1
Severity: Major
Found in app/controllers/catalog_controller.rb - About 45 mins to fix

Method build_audit_payload has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def build_audit_payload(rec, eh_new, eh_current, event, message, description = nil)
Severity: Minor
Found in app/controllers/application_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    g[key] = param_value.to_i if param_value
Severity: Major
Found in app/controllers/catalog_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

    elsif nodetype == "menu_commit_reports"
      presenter.replace(:flash_msg_div, r[:partial => "layouts/flash_msg"]) if @flash_array
      presenter.scroll_top if @flash_array.present?
      if @refresh_div
        presenter.hide(:flash_msg_div)
Severity: Major
Found in app/controllers/report_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          @right_cell_text = if @rpt.id
                               _("Editing Report \"%{name}\"") % {:name => @rpt.name}
                             else
                               _("Adding a new Report")
                             end
Severity: Major
Found in app/controllers/report_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

      presenter.scroll_top if @flash_array.present?
Severity: Major
Found in app/controllers/report_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    g[key] = param_value if param_value
Severity: Major
Found in app/controllers/catalog_controller.rb - About 45 mins to fix
Severity
Category
Status
Source
Language