Showing 286 of 1,314 total issues
Method to_chart
has a Cognitive Complexity of 16 (exceeds 11 allowed). Consider refactoring. Open
def to_chart(theme = nil, show_title = false, graph_options = nil)
ManageIQ::Reporting::Formatter::ReportRenderer.render(ManageIQ::Reporting::Charting.format) do |e|
if col_formats
# NOTE: This code intentionally does not use number_to_human_size to create a human-readable
# chart summary, because we want to match the unit of the column, regardless of the size.
- 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 sync_windows_images
has a Cognitive Complexity of 16 (exceeds 11 allowed). Consider refactoring. Open
def sync_windows_images
return if windows_images_directory.nil?
_log.info("Synchronizing Windows images on PXE Server [#{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 generate_content_complete_callback
has a Cognitive Complexity of 16 (exceeds 11 allowed). Consider refactoring. Open
def generate_content_complete_callback(status, _message, _result)
_log.info("Widget ID: [#{id}], MiqTask ID: [#{miq_task_id}], Status: [#{status}]")
miq_task.lock(:exclusive) do |locked_miq_task|
if MiqTask.status_error?(status)
- 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 calc_slope_from_data
has a Cognitive Complexity of 16 (exceeds 11 allowed). Consider refactoring. Open
def self.calc_slope_from_data(recs, x_attr, y_attr)
recs = recs.sort_by { |r| r.send(x_attr) } if recs.first.respond_to?(x_attr)
coordinates = recs.each_with_object([]) do |r, arr|
next unless r.respond_to?(x_attr) && r.respond_to?(y_attr)
- 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_actions
has a Cognitive Complexity of 16 (exceeds 11 allowed). Consider refactoring. Open
def invoke_actions(target, inputs = {})
build_actions.each do |a|
if a.kind_of?(MiqAction)
inputs = inputs.merge(:policy => self, :event => MiqEventDefinition.new(:name => "AlertEvent", :description => "Alert condition met"))
a.invoke(target, inputs.merge(:result => true, :sequence => a.sequence, :synchronous => false))
- 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 export
has a Cognitive Complexity of 16 (exceeds 11 allowed). Consider refactoring. Open
def export(options = {})
export_dir = options[:directory]
tags = if options[:all]
Classification.is_category.includes(:tag).where.not(:tags => {:name => SPECIAL_TAGS})
- 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_util_ts_chart_column
has a Cognitive Complexity of 16 (exceeds 11 allowed). Consider refactoring. Open
def build_util_ts_chart_column
categories = [] # Store categories and series counts in an array of arrays
series = []
mri.graph[:columns].each_with_index do |col, col_idx|
mri.table.data.each do |r|
- 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_user_info
has a Cognitive Complexity of 16 (exceeds 11 allowed). Consider refactoring. Open
def get_user_info(username, user_type = nil)
user = get_user_object(username, user_type)
return nil if user.nil?
udata = {}
- 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 valid?
has a Cognitive Complexity of 16 (exceeds 11 allowed). Consider refactoring. Open
def valid?(component = exp)
operator = component.keys.first
case operator.downcase
when "and", "or"
component[operator].all?(&method(:valid?))
- 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_sub_key_values
has a Cognitive Complexity of 15 (exceeds 11 allowed). Consider refactoring. Open
def self.get_sub_key_values(rec, sub_key)
unless sub_key.include?(".")
return [] unless rec.respond_to?(sub_key)
return rec.send(sub_key).downcase
- 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 request_limits
has a Cognitive Complexity of 15 (exceeds 11 allowed). Consider refactoring. Open
def self.request_limits(options)
# Memory values are in megabytes
default_max_vm_memory = 255.gigabyte / 1.megabyte
result = {
:min__number_of_sockets => 1,
- 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 retire
has a Cognitive Complexity of 15 (exceeds 11 allowed). Consider refactoring. Open
def retire(options = {})
return unless options.keys.any? { |key| [:date, :warn].include?(key) }
message = "#{retirement_object_title}: [id:<#{id}>, name:<#{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 check_supports
has a Cognitive Complexity of 15 (exceeds 11 allowed). Consider refactoring. Open
def check_supports(feature, instance:)
instance.send(:unsupported).delete(feature)
# undeclared features are not supported
value = supports_features[feature.to_sym]
- 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 check_policy_complete
has a Cognitive Complexity of 15 (exceeds 11 allowed). Consider refactoring. Open
def check_policy_complete(from_zone, status, message, result)
unless status == 'ok'
_log.error("Status = #{status}, message = #{message}")
signal(:abort, message, "error")
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 safe_log
has a Cognitive Complexity of 15 (exceeds 11 allowed). Consider refactoring. Open
def self.safe_log(worker, message = nil, exit_code = 0)
meth = (exit_code == 0) ? :info : :error
prefix = "#{log_prefix} " rescue ""
pid = "PID [#{Process.pid}] " rescue ""
- 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 target_name
has a Cognitive Complexity of 15 (exceeds 11 allowed). Consider refactoring. Open
def target_name
e_text = if @event.target_name # Create the title using Policy description
@event.target_name
elsif @event.miq_policy_id && MiqPolicy.exists?(@event.miq_policy_id) # or Policy name
MiqPolicy.find(@event.miq_policy_id).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 validate_params!
has a Cognitive Complexity of 15 (exceeds 11 allowed). Consider refactoring. Open
def validate_params!(env_vars, extra_vars, tags, ansible_runner_method, playbook_or_role_args)
errors = []
errors << "env_vars must be a Hash, got: #{hash.class}" unless env_vars.kind_of?(Hash)
errors << "extra_vars must be a Hash, got: #{hash.class}" unless extra_vars.kind_of?(Hash)
- 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 offers
has a Cognitive Complexity of 15 (exceeds 11 allowed). Consider refactoring. Open
def offers(perf, ts, options, type, target)
return nil if options.nil?
options[:mode] ||= COMPUTE_OFFERS_MODE_DEFAULT[type]
options[:metric] ||= COMPUTE_OFFERS_METRIC_DEFAULT[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 determine_visibility
has a Cognitive Complexity of 15 (exceeds 11 allowed). Consider refactoring. Open
def determine_visibility(platform, supports_customization_template, customize_fields_list)
field_names_to_edit = []
field_names_to_hide = []
if supports_customization_template
- 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_sub_xml
has a Cognitive Complexity of 15 (exceeds 11 allowed). Consider refactoring. Open
def self.process_sub_xml(xmlNode, path, options = {})
results = []
xmlNode.each_element do |e|
if e.name == 'dir'
results += process_sub_xml(e, path + '\\' + e.attributes['name'], options)
- 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"