Showing 2,015 of 18,390 total issues
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
Method rewind
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def rewind(direction)
case direction
when 'undo'
if idx.positive?
self.idx -= 1
- 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 adv_search_button
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def adv_search_button
@edit = session[:edit]
@view = session[:view]
# setting default to false
- 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
self.exp_ckey = nil unless MiqExpression.get_col_operators(exp_cfield).include?(exp_ckey)
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
@right_cell_text = if model
_("Archived %{models}") % {:models => ui_lookup(:models => model)}
else
_("Archived VMs & Templates")
end
- Create a ticketCreate a ticket
Method replace_right_cell
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def replace_right_cell(options = {})
nodetype, replace_trees = options.values_at(:nodetype, :replace_trees)
if params[:pressed] == "custom_button"
presenter = set_custom_button_dialog_presenter(options)
render :json => presenter.for_render
- 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_resolve_object?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def valid_resolve_object?
add_flash(_("Starting Class must be selected"), :error) if @resolve[:new][:starting_object].blank?
if @resolve[:new][:instance_name].blank? && @resolve[:new][:other_name].blank?
add_flash(_("Starting Process is required"), :error)
end
- 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
self.exp_key = nil unless MiqExpression.get_col_operators(:count).include?(exp_key)
- Create a ticketCreate a ticket