ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

Cyclomatic complexity for old_dialogs_update_create is too high. [17/11]
Open

  def old_dialogs_update_create
    old_dialogs_get_form_vars
    case params[:button]
    when "cancel"
      @edit = session[:edit] = nil # clean out the saved info

Checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one. Blocks that are calls to builtin iteration methods (e.g. `ary.map{...}) also add one, others are ignored.

def each_child_node(*types)               # count begins: 1
  unless block_given?                     # unless: +1
    return to_enum(__method__, *types)

  children.each do |child|                # each{}: +1
    next unless child.is_a?(Node)         # unless: +1

    yield child if types.empty? ||        # if: +1, ||: +1
                   types.include?(child.type)
  end

  self
end                                       # total: 6

Cyclomatic complexity for show is too high. [17/11]
Open

  def show
    super
    @alert = @record
    @email_to = []
    if @alert.responds_to_events == "_hourly_timer_"

Checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one. Blocks that are calls to builtin iteration methods (e.g. `ary.map{...}) also add one, others are ignored.

def each_child_node(*types)               # count begins: 1
  unless block_given?                     # unless: +1
    return to_enum(__method__, *types)

  children.each do |child|                # each{}: +1
    next unless child.is_a?(Node)         # unless: +1

    yield child if types.empty? ||        # if: +1, ||: +1
                   types.include?(child.type)
  end

  self
end                                       # total: 6

Cyclomatic complexity for explorer is too high. [17/11]
Open

  def explorer
    @explorer = true
    @trees = []
    return if perfmenu_click?

Severity: Minor
Found in app/controllers/ops_controller.rb by rubocop

Checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one. Blocks that are calls to builtin iteration methods (e.g. `ary.map{...}) also add one, others are ignored.

def each_child_node(*types)               # count begins: 1
  unless block_given?                     # unless: +1
    return to_enum(__method__, *types)

  children.each do |child|                # each{}: +1
    next unless child.is_a?(Node)         # unless: +1

    yield child if types.empty? ||        # if: +1, ||: +1
                   types.include?(child.type)
  end

  self
end                                       # total: 6

Cyclomatic complexity for replace_right_cell is too high. [17/11]
Open

  def replace_right_cell(options = {})
    action, presenter = options.values_at(:action, :presenter)
    @explorer = true
    @sb[:action] = action unless action.nil?
    if @sb[:action] || params[:display]

Checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one. Blocks that are calls to builtin iteration methods (e.g. `ary.map{...}) also add one, others are ignored.

def each_child_node(*types)               # count begins: 1
  unless block_given?                     # unless: +1
    return to_enum(__method__, *types)

  children.each do |child|                # each{}: +1
    next unless child.is_a?(Node)         # unless: +1

    yield child if types.empty? ||        # if: +1, ||: +1
                   types.include?(child.type)
  end

  self
end                                       # total: 6

Cyclomatic complexity for alert_set_record_vars is too high. [17/11]
Open

  def alert_set_record_vars(alert)
    alert.description = @edit[:new][:description]
    alert.enabled = @edit[:new][:enabled]
    alert.severity = @edit[:new][:severity]
    alert.db = @edit[:new][:db]

Checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one. Blocks that are calls to builtin iteration methods (e.g. `ary.map{...}) also add one, others are ignored.

def each_child_node(*types)               # count begins: 1
  unless block_given?                     # unless: +1
    return to_enum(__method__, *types)

  children.each do |child|                # each{}: +1
    next unless child.is_a?(Node)         # unless: +1

    yield child if types.empty? ||        # if: +1, ||: +1
                   types.include?(child.type)
  end

  self
end                                       # total: 6

Cyclomatic complexity for send_button_changes is too high. [17/11]
Open

    def send_button_changes
      if @edit
        @changed = (@edit[:new] != @edit[:current])
      elsif @assign
        @changed = (@assign[:new] != @assign[:current])

Checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one. Blocks that are calls to builtin iteration methods (e.g. `ary.map{...}) also add one, others are ignored.

def each_child_node(*types)               # count begins: 1
  unless block_given?                     # unless: +1
    return to_enum(__method__, *types)

  children.each do |child|                # each{}: +1
    next unless child.is_a?(Node)         # unless: +1

    yield child if types.empty? ||        # if: +1, ||: +1
                   types.include?(child.type)
  end

  self
end                                       # total: 6

Cyclomatic complexity for settings_set_form_vars is too high. [17/11]
Open

  def settings_set_form_vars
    @right_cell_text = if x_node.split("-").first == "z"
                         if my_zone_name == @selected_zone.name
                           _("Settings %{model} \"%{name}\" (current)") % {:name  => @selected_zone.description,
                                                                           :model => ui_lookup(:model => @selected_zone.class.to_s)}

Checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one. Blocks that are calls to builtin iteration methods (e.g. `ary.map{...}) also add one, others are ignored.

def each_child_node(*types)               # count begins: 1
  unless block_given?                     # unless: +1
    return to_enum(__method__, *types)

  children.each do |child|                # each{}: +1
    next unless child.is_a?(Node)         # unless: +1

    yield child if types.empty? ||        # if: +1, ||: +1
                   types.include?(child.type)
  end

  self
end                                       # total: 6

Cyclomatic complexity for log_depot_edit is too high. [17/11]
Open

  def log_depot_edit
    assert_privileges("#{@sb[:selected_typ] == "miq_server" ? "" : "zone_"}log_depot_edit")
    @record = @sb[:selected_typ].classify.constantize.find(@sb[:selected_server_id])
    # @schedule = nil # setting to nil, since we are using same view for both db_back and log_depot edit
    case params[:button]

Checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one. Blocks that are calls to builtin iteration methods (e.g. `ary.map{...}) also add one, others are ignored.

def each_child_node(*types)               # count begins: 1
  unless block_given?                     # unless: +1
    return to_enum(__method__, *types)

  children.each do |child|                # each{}: +1
    next unless child.is_a?(Node)         # unless: +1

    yield child if types.empty? ||        # if: +1, ||: +1
                   types.include?(child.type)
  end

  self
end                                       # total: 6

Cyclomatic complexity for ap_build_edit_screen is too high. [17/11]
Open

  def ap_build_edit_screen
    @embedded = true # don't show flash msg or check boxes in analysis profiles partial
    @scan = @edit[:scan_id] ? ScanItemSet.find(@edit[:scan_id]) : ScanItemSet.new
    @sb[:req] = "new" if %w[new copy create].include?(request.parameters["action"]) || %w[copy Host Vm].include?(params[:typ])
    @sb[:req] = "edit" if %w[edit update].include?(request.parameters["action"]) || params[:typ] == "edit"

Checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one. Blocks that are calls to builtin iteration methods (e.g. `ary.map{...}) also add one, others are ignored.

def each_child_node(*types)               # count begins: 1
  unless block_given?                     # unless: +1
    return to_enum(__method__, *types)

  children.each do |child|                # each{}: +1
    next unless child.is_a?(Node)         # unless: +1

    yield child if types.empty? ||        # if: +1, ||: +1
                   types.include?(child.type)
  end

  self
end                                       # total: 6

Cyclomatic complexity for reports_get_node_info is too high. [17/11]
Open

  def reports_get_node_info
    nodes = x_node.split('-')

    if nodes.length == 2
      @right_cell_text ||= _("%{typ} Reports") % {:typ => @sb[:rpt_menu][nodes[1].to_i][0]}

Checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one. Blocks that are calls to builtin iteration methods (e.g. `ary.map{...}) also add one, others are ignored.

def each_child_node(*types)               # count begins: 1
  unless block_given?                     # unless: +1
    return to_enum(__method__, *types)

  children.each do |child|                # each{}: +1
    next unless child.is_a?(Node)         # unless: +1

    yield child if types.empty? ||        # if: +1, ||: +1
                   types.include?(child.type)
  end

  self
end                                       # total: 6

Cyclomatic complexity for center_toolbar_filename_automate_customization is too high. [17/11]
Open

  def center_toolbar_filename_automate_customization
    if x_active_tree == :old_dialogs_tree
      return @dialog ? "miq_dialog_center_tb" : "miq_dialogs_center_tb"
    elsif x_active_tree == :dialogs_tree
      if x_node == "root"

Checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one. Blocks that are calls to builtin iteration methods (e.g. `ary.map{...}) also add one, others are ignored.

def each_child_node(*types)               # count begins: 1
  unless block_given?                     # unless: +1
    return to_enum(__method__, *types)

  children.each do |child|                # each{}: +1
    next unless child.is_a?(Node)         # unless: +1

    yield child if types.empty? ||        # if: +1, ||: +1
                   types.include?(child.type)
  end

  self
end                                       # total: 6

Function containerNodesData has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const containerNodesData = () => {
  const columns = [
    { is_narrow: true, header_text: '' },
    {
      text: 'Name', sort: 'str', col_idx: 0, align: 'left', header_text: 'Name',
Severity: Major
Found in app/javascript/spec/miq-data-table/data.js - About 2 hrs to fix

Method perf_chart_chooser has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perf_chart_chooser
    assert_privileges("perf_reload")
    @record = identify_tl_or_perf_record
    @perf_record = @record.kind_of?(MiqServer) ? @record.vm : @record # Use related server vm record

Severity: Major
Found in app/controllers/application_controller/performance.rb - About 2 hrs to fix

Method settings_replace_right_cell has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def settings_replace_right_cell(nodetype, presenter)
    case nodetype
    when "ze" # zone edit
      # when editing zone in settings tree
      if @zone.id.blank?
Severity: Major
Found in app/controllers/ops_controller.rb - About 2 hrs to fix

Method gfv_sort has 59 lines of code (exceeds 25 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: Major
Found in app/controllers/report_controller/reports/editor.rb - About 2 hrs to fix

Similar blocks of code found in 6 locations. Consider refactoring.
Open

  {
    topLeft: {
      text: '120000',
      tooltip: 'Hello, I am a very useful tooltip in the first quadrant!',
    },
Severity: Major
Found in app/javascript/spec/quadicon/data/quadicons.js and 5 other locations - About 2 hrs to fix
app/javascript/spec/quadicon/data/quadicons.js on lines 219..240
app/javascript/spec/quadicon/data/quadicons.js on lines 241..262
app/javascript/spec/quadicon/data/quadicons.js on lines 323..344
app/javascript/spec/quadicon/data/quadicons.js on lines 345..366
app/javascript/spec/quadicon/data/quadicons.js on lines 367..388

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 82.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

  {
    topLeft: {
      text: '99',
      tooltip: 'Hello, I am a very useful tooltip in the first quadrant!',
    },
Severity: Major
Found in app/javascript/spec/quadicon/data/quadicons.js and 5 other locations - About 2 hrs to fix
app/javascript/spec/quadicon/data/quadicons.js on lines 175..196
app/javascript/spec/quadicon/data/quadicons.js on lines 219..240
app/javascript/spec/quadicon/data/quadicons.js on lines 241..262
app/javascript/spec/quadicon/data/quadicons.js on lines 323..344
app/javascript/spec/quadicon/data/quadicons.js on lines 367..388

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 82.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

  {
    topLeft: {
      fileicon: '/assets/vendor-redhat.svg',
      tooltip: 'Hello, I am a very useful tooltip in the first quadrant!',
    },
Severity: Major
Found in app/javascript/spec/quadicon/data/quadicons.js and 5 other locations - About 2 hrs to fix
app/javascript/spec/quadicon/data/quadicons.js on lines 175..196
app/javascript/spec/quadicon/data/quadicons.js on lines 241..262
app/javascript/spec/quadicon/data/quadicons.js on lines 323..344
app/javascript/spec/quadicon/data/quadicons.js on lines 345..366
app/javascript/spec/quadicon/data/quadicons.js on lines 367..388

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 82.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

  {
    topLeft: {
      text: '9',
      tooltip: 'Hello, I am a very useful tooltip in the first quadrant!',
    },
Severity: Major
Found in app/javascript/spec/quadicon/data/quadicons.js and 5 other locations - About 2 hrs to fix
app/javascript/spec/quadicon/data/quadicons.js on lines 175..196
app/javascript/spec/quadicon/data/quadicons.js on lines 219..240
app/javascript/spec/quadicon/data/quadicons.js on lines 241..262
app/javascript/spec/quadicon/data/quadicons.js on lines 345..366
app/javascript/spec/quadicon/data/quadicons.js on lines 367..388

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 82.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

  {
    topLeft: {
      fileicon: '/assets/vendor-chrome.svg',
      tooltip: 'Hello, I am a very useful tooltip in the first quadrant!',
    },
Severity: Major
Found in app/javascript/spec/quadicon/data/quadicons.js and 5 other locations - About 2 hrs to fix
app/javascript/spec/quadicon/data/quadicons.js on lines 175..196
app/javascript/spec/quadicon/data/quadicons.js on lines 219..240
app/javascript/spec/quadicon/data/quadicons.js on lines 323..344
app/javascript/spec/quadicon/data/quadicons.js on lines 345..366
app/javascript/spec/quadicon/data/quadicons.js on lines 367..388

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 82.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language