Showing 18,390 of 18,390 total issues
Avoid deeply nested control flow statements. Open
next if k == :token # Skip the :token key
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if result[:request].nil?
dialog_replace_right_cell
else
flash_to_session
javascript_redirect(:controller => 'miq_request', :action => 'show_list')
- Create a ticketCreate a ticket
Method build_listnav_search_list
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_listnav_search_list(db)
@settings[:default_search] = current_user.settings[:default_search] # Get the user's default search settings again, incase default search was deleted
default_search_db = settings(:default_search, db.to_sym).to_s
if default_search_db.present? && default_search_db.to_i != 0 && MiqSearch.exists?(default_search_db)
@default_search = MiqSearch.find(default_search_db)
- 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[:vm_os] = VmOrTemplate.find(@edit.fetch_path(:new, :src_vm_id, 0)).platform if @edit.fetch_path(:new, :src_vm_id, 0)
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
elsif evm_object_class == :Vm
if params[key] == "__VM__NONE__" # Added this to deselect datastore in grid
@edit[:new][f.to_sym] = [nil, nil] # Save [value, description]
elsif v.id.to_i == val.to_i
@edit[:new][f.to_sym] = [val, v.name] # Save [value, description]
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if @edit[:new][ppid].zero? # Remove if new count is zero
pp.remove_from(session[:pol_items], session[:pol_db])
AuditEvent.success(protect_audit(pp, "remove_from", session[:pol_db], session[:pol_items]))
else # else add
pp.add_to(session[:pol_items], session[:pol_db])
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
elsif params[key] == "__DS__NONE__" # Added this to deselect datastore in grid
@edit[:new][f.to_sym] = [] # Save [value, description]
elsif v.id.to_i == val.to_i
if @edit[:new][f.to_sym].include?(val)
@edit[:new][f.to_sym].delete_if { |x| x == val }
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if params[key] == ""
@edit[:new][f.to_sym] = [nil]
else
@edit[:new][f.to_sym] = []
params[key].split(",").each { |v| @edit[:new][f.to_sym].push(v) }
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if params[key] == "__DS__NONE__" # Added this to deselect datastore in grid
@edit[:new][f.to_sym] = [nil, nil] # Save [value, description]
elsif v.id.to_i == val.to_i
@edit[:new][f.to_sym] = [val, v.name] # Save [value, description]
end
- Create a ticketCreate a ticket
Method from_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.from_options(options)
additional_options = new
additional_options.named_scope = options[:named_scope]
additional_options.gtl_dbname = options[:gtl_dbname]
additional_options.with_model(options[:model]) if options[:model]
- 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 drift_build_record_rows
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def drift_build_record_rows(view, section, records, fields)
records.each_with_index do |record, ridx|
drift_add_record(view, section, record, ridx)
unless drift_delete_row
@rows.pop
- 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 valid_active_node
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def valid_active_node(treenodeid)
modelname, rec_id, nodetype = TreeBuilder.extract_node_model_and_id(treenodeid)
return treenodeid if ["root", ""].include?(nodetype) # incase node is root or doesn't have a prefix
raise _("No Class found for explorer tree node id '%{number}'") % {:number => treenodeid} if modelname.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 scan_histories
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def scan_histories
@vm = @record = identify_record(params[:id], VmOrTemplate)
@explorer = true if request.xml_http_request? # Ajax request means in explorer
@scan_history = ScanHistory.find_by(:vm_or_template_id => @record.id)
if @scan_history.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
Avoid deeply nested control flow statements. Open
process_show_list(options) if show_list
- Create a ticketCreate a ticket
Method adv_search_load_choice
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def adv_search_load_choice
@edit = session[:edit]
if params[:chosen_search]
@edit[@expkey][:exp_chosen_report] = nil
if params[:chosen_search] == "0"
- 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 group_new_edit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def group_new_edit(typ)
@record = @custom_button_set = typ == "new" ? CustomButtonSet.new : CustomButtonSet.find(params[:id])
if typ == "edit" && x_node.split('_').last == "ub"
add_flash(_("'Unassigned Button Group' can not be edited"), :error)
get_node_info
- 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 cancel_task
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cancel_task
assert_privileges("miq_task_canceljob")
task_id = find_checked_items
task = MiqTask.find_by(:id => task_id)
message = if task.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 initiate_wait_for_task
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initiate_wait_for_task(options = {})
task_id = options[:task_id]
session[:async] ||= {}
session[:async][:interval] ||= 1000 # Default interval to 1 second
session[:async][:params] ||= {}
- 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 exp_model != '_display_filter_' &&
MiqExpression::Field.parse(exp_field).plural? &&
!%i[date datetime].include?(chosen_field_col_type) &&
chosen_field_col_type.object_id != :integer.object_id
self.exp_key = 'CONTAINS' # CONTAINS is valid only for plural tables
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
@resolve[:new][:attrs].push(attr) unless @resolve[:new][:attrs].include?(attr)
- Create a ticketCreate a ticket