ManageIQ/manageiq-ui-classic

View on GitHub
app/controllers/pxe_controller/pxe_customization_templates.rb

Summary

Maintainability
B
5 hrs
Test Coverage
F
13%

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

  def template_button_operation(method, display_name)
    templates = []

    # Either a list or coming from a different controller (eg from host screen, go to its vms)
    if !params[:id]
Severity: Minor
Found in app/controllers/pxe_controller/pxe_customization_templates.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 template_list has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def template_list
    assert_privileges('customization_template_view')
    @lastaction = "template_list"
    @force_no_grid_xml   = true
    if params[:ppsetting]                                             # User selected new per page value
Severity: Minor
Found in app/controllers/pxe_controller/pxe_customization_templates.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 template_get_node_info has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def template_get_node_info(treenodeid)
    if treenodeid == "root"
      @folders = PxeImageType.all.sort
      @right_cell_text = _("All Customization Templates - System Image Types")
      @right_cell_div  = "template_list"
Severity: Minor
Found in app/controllers/pxe_controller/pxe_customization_templates.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 customization_template_edit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def customization_template_edit
    assert_privileges("customization_template_edit")
    unless params[:id]
      obj = find_checked_items
      @_params[:id] = obj[0] unless obj.empty?
Severity: Minor
Found in app/controllers/pxe_controller/pxe_customization_templates.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

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

  def template_get_form_vars
    @ct = @edit[:ct_id] ? CustomizationTemplate.find(@edit[:ct_id]) : CustomizationTemplate.new
    copy_params_if_present(@edit[:new], params, %i[name description typ])
    @edit[:new][:img_type] = params[:img_typ] if params[:img_typ]
    @edit[:new][:script] = params[:script_data] if params[:script_data]
Severity: Minor
Found in app/controllers/pxe_controller/pxe_customization_templates.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