Showing 2,015 of 18,390 total issues
Method process_managers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_managers(managers, task)
controller_class = request.parameters[:controller]
provider_class = case controller_class
when 'ems_automation' then ManageIQ::Providers::AutomationManager
when 'ems_configuration' then ManageIQ::Providers::ConfigurationManager
- 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
elsif view.db == "MiqServer" &&
%w[ops report].include?(request.parameters[:controller])
return "/" + request.parameters[:controller] + "/tree_select/?id=" + TREE_WITH_TAB[active_tab]
elsif %w[ScanItemSet
MiqSchedule
- Create a ticketCreate a ticket
Method javascript_for_miq_button_visibility
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def javascript_for_miq_button_visibility(display, prefix = nil)
if prefix
"miqButtons('#{display ? 'show' : 'hide'}', '#{prefix}');".html_safe
else
"miqButtons('#{display ? 'show' : 'hide'}');".html_safe
- 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 perf_menu_click
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def perf_menu_click
# Parse the clicked item to get indexes and selection variables
chart_click_data = parse_chart_click(params[:menu_click])
# Swap in 'Instances' for 'VMs' in AZ breadcrumbs (poor man's cloud/infra split hack)
bc_model = %w[availability_zone host_aggregate].include?(request.parameters['controller']) && chart_click_data.model == 'VMs' ? 'Instances' : chart_click_data.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 prov_vm_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def prov_vm_data(data)
edit = data[:edit]
clones = [:clone_to_template, :clone_to_vm]
headers = prov_grid_vm_header(edit, clones, data[:vms], data[:type])
rows = []
- 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
next if @edit[:new][ppid] == @edit[:current][ppid] # Only process changes
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
elsif @edit[:new][:current_tab_key] == :purpose
build_tags_for_provisioning(@edit[:wf], @edit[:new][:vm_tags], true)
- Create a ticketCreate a ticket
Method drift_add_section_field_compressed
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def drift_add_section_field_compressed(view, section, field)
row = {}
view.ids.each_with_index do |id, idx|
fld = view.results.fetch_path(id, section[:name], field[:name])
val = fld[:_value_].to_s unless fld.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 get_timezone_offset
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_timezone_offset(user = nil, formatted = false)
tz = user ? user.get_timezone : server_timezone
tz = ActiveSupport::TimeZone::MAPPING[tz]
ActiveSupport::TimeZone.all.each do |a|
if ActiveSupport::TimeZone::MAPPING[a.name] == tz
- 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 params[key] == "__HOST__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
Avoid deeply nested control flow statements. Open
cols[i].gsub!(/\*\s/, "") if csv # If generating CSV
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
@edit[:hide_deprecated_templates] = provisioning_is_cloud? ? params[:hide_deprecated_templates] == "true" : nil
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if @edit[:wf].supports_customization_template?
build_template_grid(@edit[:wf].send("allowed_customization_templates"), @edit[:template_sortdir], @edit[:template_sortcol])
else
build_vc_grid(@edit[:wf].get_field(:sysprep_custom_spec, :customize)[:values], @edit[:vc_sortdir], @edit[:vc_sortcol])
end
- Create a ticketCreate a ticket
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