Showing 286 of 1,311 total issues
Method clear_tag
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def clear_tag(category = nil, tag_name = nil)
if category.nil?
self.tag_ids = nil
else
deletes = []
- 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 group_targets_by_ems
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def group_targets_by_ems(targets)
non_ems_targets = targets.select { |t| !t.kind_of?(ExtManagementSystem) && t.respond_to?(:ext_management_system) }
MiqPreloader.preload(non_ems_targets, :ext_management_system)
self.ems_by_ems_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 set_priority
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def set_priority(val)
# Only allow 1 Primary in the RoleScope
if val == HIGH_PRIORITY && server_role.master_supported?
if ['zone', 'region'].include?(server_role.role_scope)
method = "find_other_servers_in_#{server_role.role_scope}"
- 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 trap_v1
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def self.trap_v1(inputs)
_log.info(">> inputs=#{inputs.inspect}")
host = inputs[:host] || inputs['host']
port = inputs[:port] || inputs['port'] || 162
- 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 seed_record
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def seed_record(path, scan_item)
scan_item ||= ScanItem.new
# DB and filesystem have different precision so calling round is done in
# order to eliminate the second fractions diff otherwise the comparison
- 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 rebuild_master_list
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def rebuild_master_list
prepare_master_list
@master_list.each_slice(3) do |section, sub_sections, columns|
section = section[: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 to_export_xml
has a Cognitive Complexity of 13 (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 => ae_field.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 perf_capture
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def perf_capture(interval_name, start_time = nil, end_time = nil, target_ids = nil, rollup = false)
unless Metric::Capture::VALID_CAPTURE_INTERVALS.include?(interval_name)
raise ArgumentError, _("invalid interval_name '%{name}'") % {:name => interval_name}
end
raise ArgumentError, _("end_time cannot be specified if start_time is nil") if start_time.nil? && !end_time.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 to_export_xml
has a Cognitive Complexity of 13 (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, :namespace => namespace}
- 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_cols_from_expression
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def self.get_cols_from_expression(exp, options = {})
result = {}
if exp.kind_of?(Hash)
if exp.key?("field")
result[exp["field"]] = get_col_info(exp["field"], options) unless exp["field"] == "<count>"
- 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 walk
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def walk(settings, path = [], &block)
settings.each do |key, value|
key_path = path.dup << key
yield key, value, key_path, settings
- 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 seed
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def self.seed
action_fixture_file = File.join(FIXTURE_DIR, "miq_alert_default_action.yml")
if File.exist?(action_fixture_file)
action_hash = YAML.load_file(action_fixture_file)
action = MiqAction.new(action_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 resource_constraints
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def resource_constraints
return {} unless Settings.server.worker_monitor.enforce_resource_constraints
mem_limit = self.class.worker_settings[:memory_threshold]
cpu_limit = self.class.worker_settings[:cpu_threshold_percent]
- 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 includes_to_references
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def includes_to_references(inc)
return [] unless inc
inc = Array(inc) unless inc.kind_of?(Hash)
inc.flat_map do |n, v|
- 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 quote_human
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def self.quote_human(val, typ)
case typ&.to_sym
when :integer, :decimal, :fixnum, :float
return val.to_i unless val.to_s.number_with_method? || typ == :float
- 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_description
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def self.get_description(req_obj)
name = nil
if req_obj.source.nil?
# Single source has not been selected yet
if req_obj.options[:src_ids].length == 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 ems_alarms
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def self.ems_alarms(db, ems = nil)
ems = ExtManagementSystem.extract_objects(ems)
raise "Unable to find Management System with id: [#{id}]" if ems.nil?
to = 30
- 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_details
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def self._model_details(relats, opts)
result = []
relats[:reflections].each do |_assoc, ref|
parent = ref[:parent]
case opts[:typ]
- 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_data_types
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def validate_data_types(value, fld, msg, valid)
case fld[:data_type]
when :integer
unless is_integer?(value)
fld[:error] = msg
- 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 repository_parse_path
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def self.repository_parse_path(path)
path.tr!("\\", "/")
# it's empty string for local type
storage_name = ""
# NAS
- 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"