Showing 2,015 of 18,390 total issues
Method calculate_properties
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def calculate_properties
enabled = !disabled?
# if :enabled is not set, use disabled?
self[:enabled] = enabled if self[:enabled].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 disabled?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def disabled?
@error_message = if @view_context.x_node != 'root' && @record.server_role.regional_role?
_('This role can only be managed at the Region level')
elsif @record.active
_("Activate the %{server_role_description} Role on another Server to suspend it on %{server_name} [%{server_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
Method sorted_common_packs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sorted_common_packs
common = Webpacker::Manifest.instance.data.keys.select do |pack|
pack.ends_with?('-common.js')
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
Method custom_toolbar_class
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def custom_toolbar_class(toolbar_result)
record = @record
if @display == 'generic_objects'
model = GenericObjectDefinition
record = GenericObject.find_by(:id => @sb[:rec_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
Method service_catalog_summary
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def service_catalog_summary(record, sb_data)
data = {:title => _('Basic Info'), :mode => "miq_report_service_catalog_summary"}
image = record.picture ? {:image => "#{record.picture.url_path}?#{rand(99_999_999)}"} : {:icon => "fa fa-cube fa-4x"}
data[:rows] = [
{:cells => image},
- 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 collect_env
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def collect_env
collect_env_variables.collect do |name, value, field_path|
[
name,
value.nil? ? "REFERENCE" : "VALUE",
- 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 show_taskbar_in_header?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def show_taskbar_in_header?
return false if @explorer
return false if controller.action_name.end_with?("tagging_edit")
hide_actions = %w[
- 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 os_info_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def os_info_attributes
os_info = []
if @record.operating_system.present?
os_info = {:product_name => _("Operating System"), :service_pack => _("Service Pack"),
:productid => _("Product ID"), :version => _("Version"), :build_number => _("Build Number"),
- 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_expression
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def miq_summary_alert_expression(expression_table)
rows = []
data = {:title => _('Expression'), :mode => "miq_alert_expression", :rows => []}
if !expression_table.nil?
expression_table.each do |token|
- 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 textual_container
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def textual_container
h = {:label => _("Container")}
vendor = @record.vendor
if vendor.blank?
h[:value] = _("None")
- 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 screen_redirection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def screen_redirection(options)
if options[:redirect].present?
javascript_redirect(:controller => options[:redirect][:controller],
:action => options[:redirect][:action])
return
- 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 model_to_report_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def model_to_report_data
# @report_data_additional_options[:model] is most important, others can be removed
return @report_data_additional_options[:model] if @report_data_additional_options && @report_data_additional_options[:model]
return @display.classify if @display && @display != "main"
return params[:db].classify if params[: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
Method model_for_vm
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def model_for_vm(record)
raise _("Record is not VmOrTemplate class") unless record.kind_of?(VmOrTemplate)
if record.kind_of?(ManageIQ::Providers::CloudManager::Vm)
ManageIQ::Providers::CloudManager::Vm
elsif record.kind_of?(ManageIQ::Providers::InfraManager::Vm)
- 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 process_chart_click
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_chart_click(chart_click_data, data_row, report, ts, bc_model)
request_displayed, unavailability_reason =
if chart_click_data.model == "Current" && chart_click_data.type == "Hourly"
chart_current_hourly(ts)
elsif chart_click_data.model == "Current" && chart_click_data.type == "Daily"
- 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 textual_event_logs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def textual_event_logs
return nil if @record.kind_of?(ManageIQ::Providers::CloudManager::Template)
num = @record.operating_system.nil? ? 0 : @record.operating_system.number_of(:event_logs)
h = {:label => _("Event Logs"), :icon => "fa fa-file-text-o", :value => (num.zero? ? _("Not Available") : _("Available"))}
if num.positive?
- 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_sms
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def miq_summary_alert_send_sms(alert)
alert_options = alert.options
if alert_options && alert_options[:notifications] && alert_options[:notifications][:snmp].present?
data = {:title => _('Send SNMP Trap'), :mode => "miq_alert_send_sms", :rows => []}
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
Method my_searches_active_filter?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def my_searches_active_filter?(search)
if @edit && @edit[:expression] &&
(default_search?(search.name) && expression_selected_nil_or_id(search.id) ||
(@edit[:expression][:selected].nil? && 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 textual_usage_overcommitted
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def textual_usage_overcommitted
h = {:label => _("Unused/Overcommited Allocation")}
value = @record.uncommitted_storage
h[:title] = value.nil? ? _("N/A") : "#{number_with_delimiter(value)} bytes"
h[:value] = if value.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 perf_util_summary_info
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def perf_util_summary_info
si = {}
si[:info] = []
si[:info].push([_("Utilization Trend Summary for"), @sb[:options][:model] == "MiqEnterprise" ? "Enterprise" : "#{ui_lookup(:model => @sb[:options][:model])} [#{@perf_record.name}]"])
si[:info].push([_("Trend Interval"), "#{format_timezone(@sb[:options][:trend_start], @sb[:options][:tz], "date")} - #{format_timezone(@sb[:options][:trend_end], @sb[:options][:tz], "date")}"])
- 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 description_value
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def description_value(record)
method = description
self.description = if record.hardware.respond_to?(method)
value = record.hardware.send(method).to_s
value += " #{units}" if value.present? && units
- 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"