ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method setnode_for_customreport has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def setnode_for_customreport
    @sb[:rpt_menu].each_with_index do |level1_nodes, i|
      next unless level1_nodes[0] == reports_group_title
      level1_nodes[1].each_with_index do |level2_nodes, k|
        # Check for the existence of the Custom folder in the Reports tree and
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 1 hr 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 replace_list_grid has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def replace_list_grid
    view = @view
    button_div = 'center_tb'
    action_url = if @lastaction == "scan_history"
                   "scan_history"
Severity: Minor
Found in app/controllers/application_controller.rb - About 1 hr 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_graph_menus has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def widget_graph_menus
    @menu.each do |r|
      r[1].each do |subfolder, reps|
        subfolder.each_line do |s|
          @reps ||= []
Severity: Minor
Found in app/controllers/report_controller/widgets.rb - About 1 hr 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_all_widgets has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def get_all_widgets(nodeid = nil, rep_id = nil)
    @force_no_grid_xml   = true
    @no_checkboxes = @showlinks = true if x_active_tree != "report"
    #   @embedded = true
    if params[:ppsetting]                                             # User selected new per page value
Severity: Minor
Found in app/controllers/report_controller/widgets.rb - About 1 hr 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_edit_save_add has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def alert_edit_save_add
    id = params[:id] && params[:button] != "add" ? params[:id] : "new"
    return unless load_edit("miq_alert_edit__#{id}")

    alert = @alert = @edit[:alert_id] ? MiqAlert.find(@edit[:alert_id]) : MiqAlert.new
Severity: Minor
Found in app/controllers/miq_alert_controller.rb - About 1 hr 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 post_check has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def post_check(tree)
    stack = tree.map(&:itself)
    nodes = []
    parents = []

Severity: Minor
Found in app/presenters/tree_builder.rb - About 1 hr 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 onSubmit has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const onSubmit = (values) => {
    const data = values;
    if (data.description === undefined) {
      data.description = '';
    }

Function onSubmit has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const onSubmit = (values) => {
    const data = values;
    if (data.description === undefined) {
      data.description = '';
    }
Severity: Minor
Found in app/javascript/components/workflow-repository-form/index.jsx - About 1 hr to fix

Function onSubmit has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const onSubmit = (values) => {
    const data = values;
    if (data.description === undefined) {
      data.description = '';
    }
Severity: Minor
Found in app/javascript/components/ansible-repository-form/index.jsx - About 1 hr to fix

Method center_toolbar_filename_ops has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def center_toolbar_filename_ops
    if x_active_tree == :settings_tree
      if x_node.split('-').last == "msc"
        return "miq_schedules_center_tb"
      elsif x_node.split('-').first == "msc"
Severity: Minor
Found in app/helpers/application_helper/toolbar_chooser.rb - About 1 hr to fix

Method ap_get_form_vars_event_log has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def ap_get_form_vars_event_log
    session[:nteventlog_data] = {}
    if params[:entry]["name"] == ""
      session[:nteventlog_data][:name] = params[:entry]["name"]
      session[:nteventlog_data][:message] = params[:entry]["message"]
Severity: Minor
Found in app/controllers/ops_controller/settings/analysis_profiles.rb - About 1 hr to fix

Method get_reconfig_info has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_reconfig_info(reconfigure_ids)
          @reconfigureitems = Vm.find(reconfigure_ids).sort_by(&:name)
          # set memory to nil if multiple items were selected with different mem_cpu values
          memory = @reconfigureitems.first.mem_cpu
          memory = nil unless @reconfigureitems.all? { |vm| vm.mem_cpu == memory }
Severity: Minor
Found in app/controllers/mixins/actions/vm_actions/reconfigure.rb - About 1 hr to fix

Method rate_save_add has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def rate_save_add
    # TODO: rename chargeback_rates_edit and chargeback_rates_new to chargeback_rate_edit and chargeback_rate_new
    assert_privileges(params[:id] ? 'chargeback_rates_edit' : 'chargeback_rates_new')
    id = params[:button] == "save" ? params[:id] : "new"
    return unless load_edit("cbrate_edit__#{id}")
Severity: Minor
Found in app/controllers/chargeback_rate_controller.rb - About 1 hr to fix

Method st_set_form_vars has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def st_set_form_vars
    @edit = {}
    @edit[:rec_id] = @record.id
    @edit[:key] = "st_edit__#{@record.id || "new"}"
    @edit[:url] = "servicetemplate_edit"
Severity: Minor
Found in app/controllers/catalog_controller.rb - About 1 hr to fix

Function apply has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  apply(resolver) {
    const target = resolver.ensureHook(this.target);

    resolver.getHook(this.source).tapAsync("RailsEnginesPlugin", (request, resolveContext, callback) => {
      const engine = this.pathToEngine(request.path);
Severity: Minor
Found in config/webpack/RailsEnginesPlugin.js - About 1 hr to fix

Function onItemClick has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const onItemClick = (item, event) => {
    // If custom_action is specified, send and RxJS message with actionType set
    // to custom_action value.
    if (additionalOptions && additionalOptions.custom_action) {
      sendDataWithRx({
Severity: Minor
Found in app/javascript/components/gtl-view.jsx - About 1 hr to fix

Method tag_edit_build_screen has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def tag_edit_build_screen
    @showlinks = true
    @edit[:object_ids] ||= @object_ids

    cats = Classification.categories.select(&:show).sort_by { |t| t.description.try(:downcase) } # Get the categories, sort by description
Severity: Minor
Found in app/controllers/application_controller/tags.rb - About 1 hr to fix

Method update_fields has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def update_fields
    assert_privileges('miq_ae_field_edit')
    return unless load_edit("aefields_edit__#{params[:id]}", "replace_cell__explorer")

    fields_get_form_vars
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr to fix

Method db_seq_edit has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def db_seq_edit
    assert_privileges("db_seq_edit")
    case params[:button]
    when "cancel"
      @edit = session[:edit] = nil # clean out the saved info
Severity: Minor
Found in app/controllers/report_controller/dashboards.rb - About 1 hr to fix

Method attributes_data has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def attributes_data
    attributes = if @ems.supports?(:block_storage)
                   %i[physical_storages storage_resources cloud_volumes cloud_volume_snapshots volume_mappings host_initiators host_initiator_groups storage_services]
                 else
                   %i[cloud_object_store_containers cloud_object_store_objects]
Severity: Minor
Found in app/services/ems_storage_dashboard_service.rb - About 1 hr to fix
Severity
Category
Status
Source
Language