ManageIQ/manageiq-ui-classic

View on GitHub
app/helpers/report_helper/report_information_helper.rb

Summary

Maintainability
C
7 hrs
Test Coverage
F
13%

Method report_schedule has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def report_schedule(schedules)
    data = {:title => _('Schedules'), :mode => "miq_report_schedules bordered-list simple_table", :rows => []}
    if schedules.blank?
      data[:message] = _("Report is not Scheduled.")
    else
Severity: Minor
Found in app/helpers/report_helper/report_information_helper.rb - About 3 hrs 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 report_information has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def report_information(sb_data, report)
    if sb_data[:miq_report_id] && report
      data = {:title => _('Basic Information'), :mode => 'miq_report_basic_information'}
      rows = []
      rows.push(row_data(_('ID'), report.id))
Severity: Minor
Found in app/helpers/report_helper/report_information_helper.rb - About 2 hrs 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 report_schedule has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def report_schedule(schedules)
    data = {:title => _('Schedules'), :mode => "miq_report_schedules bordered-list simple_table", :rows => []}
    if schedules.blank?
      data[:message] = _("Report is not Scheduled.")
    else
Severity: Minor
Found in app/helpers/report_helper/report_information_helper.rb - About 1 hr to fix

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

  def report_widget(widget_nodes)
    data = {:title => _('Widgets'), :mode => "miq_report_widgets bordered-list simple_table", :rows => []}
    if widget_nodes.blank?
      data[:message] = _("Report doesn't belong to Widgets.")
    else
Severity: Minor
Found in app/helpers/report_helper/report_information_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

There are no issues that match your filters.

Category
Status