Showing 2,015 of 18,390 total issues
Method delete
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def delete
# TODO: this will be unnecessary after `chargeback_rates_delete` gets renamed to `chargeback_rate_delete`
assert_privileges("chargeback_rates_delete")
rates = []
if !params[:id] # showing a 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 show_details
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def show_details(db, options = {})
association = options[:association]
scopes = options[:scopes]
@showtype = "details"
@display = "main"
- 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
Avoid deeply nested control flow statements. Open
model, model_id, _ = TreeBuilder.extract_node_model_and_id(options[:x_node]) if options[:x_node]
- Create a ticketCreate a ticket
Method servicetemplate_edit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def servicetemplate_edit
assert_privileges_for_servicetemplate_edit
checked_id = find_checked_items.first || params[:id]
@sb[:cached_waypoint_ids] = MiqAeClass.waypoint_ids_for_state_machines
- 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
Avoid deeply nested control flow statements. Open
if @custom_button.uri_attributes
default_attributes = if @custom_button[:options].try(:[], :button_type)
%w[request service_template_name hosts]
else
%w[request]
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if @custom_button.visibility && @custom_button.visibility[:roles] && @custom_button.visibility[:roles][0] != "_ALL_"
MiqUserRole.all.sort_by(&:name).each do |r|
@sb[:user_roles].push(r.name) if @custom_button.visibility[:roles].include?(r.name)
end
end
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
@resolve[:new][:target_class] = if @nodetype[0].starts_with?("-ub-")
# selected button is under unassigned folder
@nodetype[0].sub('-ub-', '')
else
@nodetype[1]
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
@enablement_expression_table = exp_build_table(@custom_button.enablement_expression.exp) if @custom_button.enablement_expression.kind_of?(MiqExpression)
- Create a ticketCreate a ticket
Method verify_hosts_for_scaledown
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def verify_hosts_for_scaledown(hosts)
has_invalid_nodes = false
error_return_message = _("Not all hosts can be removed from the deployment.")
hosts.each do |host|
- 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 vm_chargeback
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def vm_chargeback
@sb[:action] ||= 'chargeback'
@vm = @record = identify_record(params[:id], VmOrTemplate)
unless @record.has_perf_data?
add_flash(_('No Capacity & Utilization data has been collected for this VM'))
- 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
Avoid deeply nested control flow statements. Open
node = TreeNode.new(record) if record
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
@sb[:buttons].push(button) unless @sb[:buttons].include?(button)
- Create a ticketCreate a ticket
Method get_form_vars
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_form_vars
@edit[:new][:cbshow_typ] = params[:cbshow_typ] if params[:cbshow_typ]
@edit[:new][:cbtag_cat] = nil if params[:cbshow_typ] # Reset categories pull down if assign to selection is changed
@edit[:new][:cbtag_cat] = params[:cbtag_cat].to_s if params[:cbtag_cat]
@edit[:new][:cblabel_key] = nil if params[:cbshow_typ]
- 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
Avoid deeply nested control flow statements. Open
if details
add_flash(_("Re-checking Authentication status for this %{controller_name} was not successful: %{details}") %
{:controller_name => ui_lookup(:table => controller_name), :details => details}, :error)
end
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
next if b.custom_button_sets.present?
- Create a ticketCreate a ticket
Method scaledown
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def scaledown
assert_privileges("ems_infra_scale")
redirect_to(ems_infra_path(params[:id])) if params[:cancel]
# Hiding the toolbars
- 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
Avoid deeply nested control flow statements. Open
@sb[:dialog_label] = dialog_id ? Dialog.find(dialog_id).label : ""
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
next if bidx != b.id
- Create a ticketCreate a ticket
Method widget_add
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def widget_add
assert_privileges("dashboard_add")
if params[:widget] # Make sure we got a widget in
w = params[:widget].to_i
if @sb[:dashboards][@sb[:active_db]][:col2].length < @sb[:dashboards][@sb[:active_db]][:col1].length
- 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"