Showing 2,015 of 18,390 total issues
Method apply_common_props
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def apply_common_props(button, input)
button.update(
:color => input[:color],
:data => button.data(input[:data]),
:hidden => button[:hidden] || !!input[:hidden],
- 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_button_add_related_buttons
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def custom_button_add_related_buttons(model, record, toolbar)
# For Service, we include buttons for ServiceTemplate.
# These buttons are added as a single group with multiple buttons
if record.kind_of?(Service)
service_buttons = record_to_service_buttons(record)
- 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
return @lastaction == 'show_list' ? "#{@layout.pluralize}_center_tb" : "#{@layout}_center_tb"
- Create a ticketCreate a ticket
Method generic_button
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def generic_button(type, id, icon, title, text, keys)
- Create a ticketCreate a ticket
Method custom_button_selects
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def custom_button_selects(model, record, toolbar_result)
get_custom_buttons(model, record, toolbar_result).collect do |group|
buttons = group[:buttons].collect { |b| create_custom_button(b, model, record) }
enabled = if cb_send_checked_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
Avoid deeply nested control flow statements. Open
elsif @layout == "configuration_profile"
return "configuration_profile_center_tb"
elsif @layout == "configuration" && @tabform == "ui_4"
return "time_profiles_center_tb"
elsif @layout == "diagnostics"
- Create a ticketCreate a ticket
Method disabled?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def disabled?
@error_message = if @record.master_supported?
if @record.priority == 1 || @record.priority == 2
if @view_context.x_node != "root" && @record.server_role.regional_role?
_("This role can only be managed at the Region level")
- 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 x_node == "root"
return "iso_datastores_center_tb"
elsif x_node_split.first == "isi"
# on image node
return "iso_image_center_tb"
- Create a ticketCreate a ticket
Method center_toolbar_name_vm_or_template
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def center_toolbar_name_vm_or_template
if @record
return "vm_performance_tb" if @display == "performance"
case @record
- 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 row_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def row_data(label, value, style = "", icon: false)
if value.kind_of?(Array)
{:cells => {:label => label, (icon ? :icon : :value) => [value[0], value[1]].join(', '), :color => style}}
else
{:cells => {:label => label, (icon ? :icon : :value) => value, :color => style}}
- 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 nodes.length == 2 && nodes[0] == "xx-ab"
return "custom_button_set_center_tb" # CI node is selected
elsif (nodes.length == 1 && nodes[0].split('-').length == 3 && nodes[0].split('-')[1] == "ub") ||
(nodes.length == 3 && nodes[0] == "xx-ab")
return "custom_buttons_center_tb" # group node is selected
- Create a ticketCreate a ticket
Method view_toolbar_filename
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def view_toolbar_filename
if render_download_view_tb?
'download_view_tb'
elsif @lastaction == "compare_miq" || @lastaction == "compare_compress"
'compare_view_tb'
- 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 x_active_tree == :widgets_tree
node = x_node
return node == "root" || node.split('-').length == 2 ? "miq_widgets_center_tb" : "miq_widget_center_tb"
- Create a ticketCreate a ticket
Method settings_analysis_profile_summary
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def settings_analysis_profile_summary(selected_scan, categories, files, file_stats, registry, nteventlog)
- Create a ticketCreate a ticket
Method record_name
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def record_name(rec)
column = rec.display_name.blank? ? :name : :display_name
rec_name = if rec.kind_of?(MiqAeNamespace) && rec.domain?
editable_domain?(rec) && rec.enabled ? rec.send(column) : add_read_only_suffix(rec.send(column), editable_domain?(rec), rec.enabled)
else
- 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
return x_node == "root" ? "miq_report_schedules_center_tb" : "miq_report_schedule_center_tb"
- Create a ticketCreate a ticket
Method center_toolbar_filename_storage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def center_toolbar_filename_storage
if x_active_tree == :storage_tree
if x_node_split.first == 'ds'
return "storage_center_tb"
else
- 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 def_searches_active_filter?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def def_searches_active_filter?(search)
if @edit && @edit[:expression] &&
((default_search?(search.name) || no_default_search?(search.id)) && expression_selected_nil_or_id(search.id) ||
(@edit[:expression][:selected] && @edit[:expression][:selected][:id].zero? && search.id.to_i.zero? ||
expression_selected_id_or_name(:name, search.name)))
- 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 miq_summary_alert_send_email
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def miq_summary_alert_send_email(alert, email_to)
alert_options = alert.options
if alert_options && alert_options[:notifications] && alert.options[:notifications][:email].present?
rows = []
data = {:title => _('Send E-mail'), :mode => "miq_alert_send_email", :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
if @tagging
return false # when tagging Users, Groups, Roles and Tenants, the table is non-clickable
else
return "/" + request.parameters[:controller] + "/tree_select/?id=" + x_node.split("-")[1]
end
- Create a ticketCreate a ticket