Showing 286 of 1,311 total issues
Method v_calc_pct_of_cpu_time
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def v_calc_pct_of_cpu_time(vcol)
col = vcol.to_s.split("_")[2..-1].join("_")
return nil if send(col).nil?
int, default_intervals_in_rollup = CHILD_ROLLUP_INTERVAL[capture_interval_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 authorized_for_user?
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def authorized_for_user?(userid)
user = User.lookup_by_userid(userid)
mfilters = user ? user.get_managed_filters : []
bfilters = user ? user.get_belongsto_filters : []
db = self.class
- 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 build_sort_suffix_data
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def build_sort_suffix_data
new_sortby = []
rpt_sortby = Array.wrap(sortby)
rpt_sortby.each do |sb|
col, sfx = sb.split("__")
- 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 partition_group_and_level_by_event_type
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
private_class_method def self.partition_group_and_level_by_event_type
return @literal_group_and_level_by_event_type, @regex_group_and_level_by_event_type if @literal_group_and_level_by_event_type
@literal_group_and_level_by_event_type = {}
@regex_group_and_level_by_event_type = {}
- 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 create_new_metric
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def self.create_new_metric(klass, last_perf, perf, interval)
attrs = last_perf.attributes
attrs.delete('id')
attrs['timestamp'] += interval
attrs['capture_interval'] = 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 invoke_tasks_remote
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def invoke_tasks_remote(options)
ApplicationRecord.group_ids_by_region(options[:ids]).each do |region, ids|
remote_options = options.merge(:ids => ids)
begin
- 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 report_row_key
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def self.report_row_key(consumption)
ts_key = @options.start_of_report_step(consumption.timestamp)
if @options[:groupby_tag].present?
classifications = @options.classification_for(consumption)
if classifications.present?
- 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 activate_in_region
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def activate_in_region(override = false)
return unless server_role.role_scope == 'region'
if override || inactive?
MiqRegion.my_region.lock do
- 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_capture_queue
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def perf_capture_queue(interval, start_time: nil, end_time: nil, rollups: false)
if interval == "realtime" && Metric::Capture.historical_days != 0
historical_start = Metric::Capture.historical_start_time
historical_end = 1.day.from_now.utc.beginning_of_day
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 queue_merge
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def self.queue_merge(targets, ems, create_task = false)
queue_options = {
:queue_name => ems.queue_name_for_ems_refresh,
:class_name => name,
:method_name => 'refresh',
- 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 to_export_xml
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def to_export_xml(options = {})
require 'builder'
xml = options[:builder] ||= ::Builder::XmlMarkup.new(:indent => options[:indent])
xml_attrs = {:name => name, :substitute => substitute.to_s}
- 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 calculate_max_col_widths
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def calculate_max_col_widths
mri = options.mri
tz = mri.get_time_zone(Time.zone.name)
@max_col_width = []
- 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 set_on_vm_id_changed
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def set_on_vm_id_changed
src = get_source_and_targets
vm, ems = load_ar_obj(src[:vm]), src[:ems]
clear_field_values(fields_to_clear)
- 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 parse_ws_string
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def self.parse_ws_string(text_input, options = {})
return parse_request_parameter_hash(text_input, options) if text_input.kind_of?(Hash)
return {} unless text_input.kind_of?(String)
deprecated_warn = "method: parse_ws_string, arg Type => String"
- 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 exp_find_by_token
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def exp_find_by_token(exp, token, parent_is_not = false)
if exp.kind_of?(Array) # Is this and AND or OR
result = nil
exp.find do |e|
result = exp_find_by_token(e, token) # Look for 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 scan_queue
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def self.scan_queue(miq_task, queue_limit = 1)
queued = 0
unprocessed = scan_storages_unprocessed(miq_task)
loop do
storage_id = unprocessed.shift
- 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 build_document_header
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def build_document_header
mri = options.mri
raise "No settings configured for Table" if mri.table.nil?
calculate_max_col_widths
- 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 build_document_body
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def build_document_body
mri = options.mri
tz = mri.get_time_zone(Time.zone.name)
# Calculate the earliest time of events to show
unless mri.timeline[:last_unit].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 exp_replace_qs_tokens
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def exp_replace_qs_tokens(exp, tokens)
key = exp.keys.first
if %w[and or].include?(key)
exp[key].each { |e| exp_replace_qs_tokens(e, tokens) }
elsif key == "not"
- 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 session
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def session(data)
valid, errors = true, []
keys = data.each_pair.to_a.transpose.first.to_set
- 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"