Showing 829 of 829 total issues
Avoid deeply nested control flow statements. Open
Open
next if updating && ((property_name == '_id' || primary_fields.include?(name.to_sym)) && !record.send(property_name).nil?)
Avoid deeply nested control flow statements. Open
Open
if (existing = Cenit::Utility.find_record({ id: json }, container))
record = existing
else
record.id = json
end
Avoid deeply nested control flow statements. Open
Open
if (resume_interval = task.resume_interval)
message[:publish_at] = Time.now + resume_interval
end
Avoid deeply nested control flow statements. Open
Open
raise Exception.new('Can not infers segment separator without EDI segment metadata in next sub-segment schema') unless next_seg_schema['edi'] && next_seg_id = next_seg_schema['edi']['segment']
Avoid deeply nested control flow statements. Open
Open
if field_sep == :by_fixed_length
value.join
else
while value.last.blank?
value.pop
Avoid deeply nested control flow statements. Open
Open
return false unless save_references(value, options, saved, visited)
Avoid deeply nested control flow statements. Open
Open
if Cenit::Utility.json_object?(sub_record)
json_objects << sub_record
else
elements << record_to_xml_element(data_type, property_schema, sub_record, xml_doc, nil, options, namespaces)
end
Avoid deeply nested control flow statements. Open
Open
if (obj = (obj.reload rescue nil))
Avoid deeply nested control flow statements. Open
Open
if delayed
Setup::DelayedMessage.create(message: message, publish_at: publish_at, scheduler: scheduler)
else
begin
channel_mutex.lock
Avoid deeply nested control flow statements. Open
Open
next unless updating || !property_model&.modelable? || record.send(property_name).nil?
Avoid deeply nested control flow statements. Open
Open
if json.key?(name)
record.send("#{property_name}=", json[name])
end
Avoid deeply nested control flow statements. Open
Open
if fields_count.positive?
while fields_count.positive?
cursor = content.index(field_sep, cursor) + 1
fields_count -= 1
end
Method array_hash_merge
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def array_hash_merge(val1, val2, options = {}, &block)
if val1.is_a?(Array) && val2.is_a?(Array)
if options[:array_uniq]
(val2 + val1).uniq(&block)
else
- Read upRead up
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
Open
values = [values] unless values.is_a?(Array)
Avoid deeply nested control flow statements. Open
Open
unless saved.include?(value)
new_record = value.new_record?
if value.changed?
if value.save(options)
if new_record || value.instance_variable_get(:@dynamically_created)
Method file_stores
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def file_stores(*args)
if args.length.zero?
options[:file_stores] || [options.key?(:default_file_store) ? default_file_store : Cenit::FileStore::LocalDb]
else
args = args.flatten
- Read upRead up
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
Open
if (sub_record = do_parse_xml(data_type, property_model, sub_element, options, property_schema, nil, nil, property))
record.send("#{property}=", sub_record)
end
Avoid deeply nested control flow statements. Open
Open
if (token = message[:token])
TaskToken.where(token: token).delete_all
end
Avoid deeply nested control flow statements. Open
Open
members = [members] unless members.is_a?(Array)
Avoid deeply nested control flow statements. Open
Open
if (association_track = associations[property])
next unless associations[:kept]
sub_values = association_track[:new]
else
associations[property] = {