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]
- Read upRead up
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
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"
- Read upRead up
- Create a ticketCreate a ticket
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?
- Read upRead up
- Create a ticketCreate a ticket
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]
- Read upRead up
- Create a ticketCreate a ticket
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"