ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,001 of 18,265 total issues

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

  def retrieve_email
    assert_privileges("miq_request_edit")
    @edit = session[:edit]
    begin
      method = WORKFLOW_METHOD_WHITELIST[params[:field]]
Severity: Minor
Found in app/controllers/miq_request_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

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

      def set_attribute(attribute, value = nil, &block)
        atvar = "@#{attribute}".to_sym

        define_method(attribute) do
          result = instance_variable_get(atvar)
Severity: Minor
Found in app/presenters/tree_node/node.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_menu_cols_top has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def move_menu_cols_top
    if params[:selected_reports].blank? || params[:selected_reports][0] == ""
      add_flash(_("No fields were selected to move up") % "", :error)
      return
    end
Severity: Minor
Found in app/controllers/report_controller/menus.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 miq_report_schedule_delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def miq_report_schedule_delete
    assert_privileges("miq_report_schedule_delete")
    scheds = find_records_with_rbac(MiqSchedule, checked_or_params)
    single_name = scheds.first.name if scheds.length == 1
    process_schedules(scheds, "destroy") unless scheds.empty?
Severity: Minor
Found in app/controllers/report_controller/schedules.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 schedule_set_record_vars has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def schedule_set_record_vars(schedule)
    schedule.name = @edit[:new][:name]
    schedule.description = @edit[:new][:description]
    schedule.enabled = @edit[:new][:enabled]
    schedule.resource_type = "MiqReport" # Default schedules apply to MiqReport model for now
Severity: Minor
Found in app/controllers/report_controller/schedules.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 show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    identify_request
    return if record_no_longer_exists?(@miq_request)

    @display = params[:display] || "main" unless pagination_or_gtl_request?
Severity: Minor
Found in app/controllers/miq_request_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

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

  def x_get_tree_datacenter_kids(parent, count_only)
    children = parent.folders.each_with_object([]) do |child, arr|
      next unless child.kind_of?(EmsFolder)

      case child.name
Severity: Minor
Found in app/presenters/tree_builder_belongs_to_hac.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 x_get_tree_region_kids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def x_get_tree_region_kids(object, count_only)
    emses = Rbac.filtered(object.ems_infras)
    storages = Rbac.filtered(object.storages)
    if count_only
      emses.count + storages.count
Severity: Minor
Found in app/presenters/tree_builder_utilization.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 alert_build_snmp_variables has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def alert_build_snmp_variables
    @edit[:new][:snmp][:snmp_version] = "v1" if @edit[:new][:snmp][:snmp_version].blank?
    @edit[:snmp_var_types] = MiqSnmp.available_types
    @edit[:new][:snmp][:variables] ||= []
    10.times do |i|
Severity: Minor
Found in app/controllers/miq_alert_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

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

  def request_edit
    assert_privileges(rbac_feature_id("miq_request_edit"))
    provision_request = MiqRequest.find(params[:id])
    if provision_request.workflow_class || provision_request.kind_of?(MiqProvisionConfiguredSystemRequest)
      request_edit_settings(provision_request)
Severity: Minor
Found in app/controllers/miq_request_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

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

    def to_h
      {
        :key            => key,
        :text           => escape(text),
        :tooltip        => escape(tooltip),
Severity: Minor
Found in app/presenters/tree_node/node.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 x_get_tree_kids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def x_get_tree_kids(parent, count_only, parents)
    generator = self.class.kids_generators.detect { |k, v| v if parent.kind_of?(k) }
    return nil unless generator
    method = generator[1][0]
    attributes = generator[1][1..-1].collect do |attribute_name|
Severity: Minor
Found in app/presenters/tree_kids.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 x_get_tree_hash_kids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def x_get_tree_hash_kids(parent, count_only)
    kids = []
    kids.concat(profile_nodes(parent[:profiles])) if parent[:profiles].present?
    kids.concat(policy_nodes(parent[:policies])) if parent[:policies].present?
    kids.concat(condition_nodes(parent[:conditions])) if parent[:conditions].present?
Severity: Minor
Found in app/presenters/tree_builder_policy_simulation_results.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_display has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def set_display
    @display = params[:display]
    @display ||= default_display unless pagination_or_gtl_request?
    @display ||= 'generic_objects' if role_allows?(:feature => "generic_object_view") && @record.number_of(:generic_objects).positive?
  end
Severity: Minor
Found in app/controllers/service_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

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

  def edit
    @_params[:pressed] ||= "miq_alert_edit"
    assert_privileges(params[:pressed]) if params[:pressed]
    case params[:button]
    when "cancel"
Severity: Minor
Found in app/controllers/miq_alert_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

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

  def move_menu_cols_left
    if params[:available_reports].blank? || params[:available_reports][0] == ""
      add_flash(_("No fields were selected to move left"), :error)
    else
      @edit[:available_reports].each do |af|                  # Go thru all available columns
Severity: Minor
Found in app/controllers/report_controller/menus.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 x_build_tree has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def x_build_tree
    nodes = x_get_tree_objects(nil, false, []).map do |child|
      # already a node? FIXME: make a class for node
      if child.kind_of?(Hash) && child.key?(:text) && child.key?(:key) && child.key?(:image)
        child
Severity: Minor
Found in app/presenters/tree_builder.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 validate_user_pre_auth_checks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_user_pre_auth_checks(user)
    # Pre_authenticate checks
    return ValidateResult.new(:fail, _("Error: Name is required")) if user.blank? || user[:name].blank?

    return ValidateResult.new(:fail, _("Error: New password and verify password must be the same")) if
Severity: Minor
Found in app/services/user_validation_service.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 x_get_compliance_kids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def x_get_compliance_kids(parent, count_only)
    kids = []
    if parent.compliance_details.empty?
      kid = {:id         => "#{parent.id}-nopol",
             :text       => _("No Compliance Policies Found"),
Severity: Minor
Found in app/presenters/tree_builder_compliance_history.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 find_chart_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def find_chart_path
    if @fname
      # First, if this class specified a chart layout path, use it.
      return chart_path(@layout, @perf_record.chart_layout_path) if
        @perf_record.respond_to?(:chart_layout_path)
Severity: Minor
Found in app/services/charts_layout_service.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