Showing 2,015 of 18,390 total issues
Avoid deeply nested control flow statements. Open
temp.push(el) unless temp.include?(el)
- Create a ticketCreate a ticket
Method ems_utilization
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ems_utilization
used_cpu = Hash.new(0)
used_mem = Hash.new(0)
total_cpu = Hash.new(0)
total_mem = Hash.new(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 x_get_tree_roots
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def x_get_tree_roots
nodes = []
group = nil
@data.master_list.each_slice(3) do |section, _records, _fields|
if group.blank? || section[:group] != group
- 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 prune_folders_via_folders
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def prune_folders_via_folders(tree, allowed_folder_ids)
has_sub_folders = false
tree.select! do |object, children|
has_sub_sub_folders = prune_folders_via_folders(children, allowed_folder_ids)
- 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 fill_utilization
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def fill_utilization(m, time, used_cpu, used_mem, total_cpu, total_mem)
- Create a ticketCreate a ticket
Method x_get_tree_pxe_server_kids
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def x_get_tree_pxe_server_kids(object, count_only)
pxe_images = object.pxe_images
win_images = object.windows_images
if count_only
open_node("xx-pxe_xx-#{object.id}")
- 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
Consider simplifying this complex logical expression. Open
if (isEdit) {
http.get(`/miq_ae_customization/old_dialogs_edit_get/${dialogRecord.id}/`).then((recordValues) => {
if (recordValues) {
setData({ ...data, isLoading: false, initialValues: recordValues });
}
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if item.leaf?
# FIXME: remove @layout condition when every controller sets menu_section properly
active = controller.menu_section_id(controller.params) || @layout.to_sym
item.id.to_sym == active || item.id.to_sym == @layout.to_sym
else
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if (@lastaction != "show" || (@lastaction == "show" && @display != "main")) &&
@record &&
(@record.respond_to?('name') && !@record.name.nil?)
return true
else
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if DRIFT_TIME_COLUMNS.include?(datum[0].to_s) && datum[1].kind_of?(Hash) &&
datum[1].key?(:_value_) && datum[1][:_value_].present? &&
datum[1][:_value_] != "" && datum[1][:_value_] != MiqCompare::EMPTY
datum[1][:_value_] = format_timezone(datum[1][:_value_], Time.zone, "view")
end
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if params[:chosen_value] || params[:chosen_regkey] || params[:chosen_regval] ||
params[:chosen_cvalue || params[:chosen_suffix]] || params[:alias]
render :update do |page|
page << javascript_prologue
end
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if hourly_date.present? &&
(hourly_date.to_date < sdate.to_date || hourly_date.to_date > edate.to_date || # it is out of range
(typ == 'Hourly' && time_profile && !time_profile_days.include?(hourly_date.to_date.wday))) # or out of profile
self.hourly_date = nil
end
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if datum[1].kind_of?(Hash) && datum[1].key?(:_value_) &&
datum[1][:_value_].kind_of?(Time) && datum[1][:_value_].present? &&
datum[1][:_value_] != "" && datum[1][:_value_] != MiqCompare::EMPTY
datum[1][:_value_] = format_timezone(datum[1][:_value_], Time.zone, "view")
end
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if params.key?(:instance_name) || params.key?(:starting_object) ||
params.key?(:target_class) || params.key?(:target_id) ||
params.key?(:other_name) || params.key?(:target_attr_name)
unless params.key?(:other_name) || params.key?(:target_attr_name)
page.replace("resolve_form_div", :partial => "resolve_form")
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if params[:user_name].blank? && params[:user_password].blank? &&
request.headers["X-Remote-User"].blank? &&
::Settings.authentication.mode == "httpd" &&
::Settings.authentication.sso_enabled &&
params[:action] == "authenticate"
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
elsif record_showing || @in_a_form || @sb[:buttons_node] ||
(@pages && (@items_per_page == ONE_MILLION || @pages[:items] == 0))
if %w[button_edit group_edit group_reorder at_st_new st_new st_catalog_new st_catalog_edit copy_catalog].include?(action)
presenter.hide(:toolbar).show(:paging_div)
# incase it was hidden for summary screen, and incase there were no records on show_list
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if !features? || options[:not_tree]
# Append breadcrumb from @record item (eg "Openstack") when on some action page (not show, display)
breadcrumbs.push(build_breadcrumbs_no_explorer(options[:record_info], options[:record_title])) if not_show_page? || options[:include_record]
# Append tag and policy breadcrumb if they exist
- Create a ticketCreate a ticket
Function saveRecord
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function saveRecord(apiURL, redirectURL, object, successMsg, action) {
- Create a ticketCreate a ticket
Function createSchema
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function createSchema(ems, cloudNetworkId, loadSchema, emptySchema, providerFields = []) {
- Create a ticketCreate a ticket
Function adjustValidationStatus
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var adjustValidationStatus = function(value, scope, ctrl, attrs, rootScope) {
- Create a ticketCreate a ticket