Showing 18,390 of 18,390 total issues
Avoid deeply nested control flow statements. Open
rescue => bang
title = params[:button] == "add" ? "add" : "update"
add_flash(_("Error during '%{title}': %{message}") % {:title => title, :message => bang.message}, :error)
- Create a ticketCreate a ticket
Method set_search_text
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_search_text
@sb[:pol_search_text] ||= {}
if params[:search_text]
@search_text = params[:search_text].strip
@sb[:pol_search_text][x_active_tree] = @search_text unless @search_text.nil?
- 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 custom_toolbar_simple
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def custom_toolbar_simple
if @record && %w[show show_dashboard].include?(@lastaction) && %w[dashboard main].include?(@display)
Mixins::CustomButtons::Result.new(:single)
elsif @lastaction == "show_list" || relationship_table_screen?
Mixins::CustomButtons::Result.new(: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 reconfigure
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def reconfigure(reconfigure_ids = [])
@sb[:explorer] = true if @explorer
@request_id = nil
@in_a_form = @reconfigure = true
drop_breadcrumb(:name => _("Reconfigure"), :url => "/vm_common/reconfigure")
- 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 process_hosts_maintenance
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_hosts_maintenance(hosts, display_name)
each_host(hosts, display_name) do |host|
if host.maintenance
if host.supports?(:unset_node_maintenance)
host.unset_node_maintenance_queue(session[:userid])
- 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 find_checked_items
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_checked_items(prefix = nil)
if params[:miq_grid_checks].present?
params[:miq_grid_checks].split(",").collect(&:to_i)
else
prefix = "check" if prefix.nil?
- 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 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"