Showing 62 of 62 total issues
Method load_descendants
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def load_descendants(root)
root_type = join_field_type(root)
return [] unless root_type
descendant_ids = []
- 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
Method delete_single_entry
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def delete_single_entry(object, root: object)
entry = {}
entry[:_id] = entry_id(object)
entry[:_id] ||= object.as_json
- 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
Method pluck_in_batches
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def pluck_in_batches(scope, fields: [], batch_size: nil, typecast: true)
unless block_given?
return enum_for(
:pluck_in_batches,
scope,
- 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
Method pluck
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def pluck(scope, fields: [], typecast: true)
if typecast
scope.except(:includes).distinct.pluck(primary_key, *fields)
else
scope = scope.except(:includes).distinct
- 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
Method import_fields
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def import_fields(*args, &block)
return enum_for(:import_fields, *args) unless block_given?
options = args.extract_options!
options[:batch_size] ||= BATCH_SIZE
- 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
Method import_fields
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def import_fields(*args, &block)
return enum_for(:import_fields, *args) unless block_given?
collection, options = import_args(*args)
- 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
Method load
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load(ids, **options)
if target.respond_to?(load_all_method)
if target.method(load_all_method).arity == 1
target.send(load_all_method, ids)
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
Method ==
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ==(other)
return true if super
if other.is_a?(Chewy::Index)
self.class == other.class && (respond_to?(:id) ? id == other.id : attributes == other.attributes)
- 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
Method upgrade
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def upgrade(only: nil, except: nil, parallel: nil, output: $stdout)
warn_missing_index(output)
subscribed_task_stats(output) do
indexes = indexes_from(only: only, except: except)
- 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
Method import_objects
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def import_objects(collection, options)
collection_ids = identify(collection)
hash = collection_ids.map(&:to_s).zip(collection).to_h
indexed = collection_ids.each_slice(options[:batch_size]).map do |ids|
- 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
Method reset!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def reset!(suffix = nil, apply_journal: true, journal: false, **import_options)
result = if suffix.present?
start_time = Time.now
indexes = self.indexes - [index_name]
create! suffix, alias: false
- 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
Method perform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def perform(body)
return [] if body.blank?
request_bodies(body).each_with_object([]) do |request_body, results|
response = @index.client.bulk(**request_base.merge(body: request_body)) if request_body.present?
- 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
Method value_by_name_proc
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def value_by_name_proc(message)
proc do |object|
if object.is_a?(Hash)
if object.key?(message)
object[message]
- 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
Method replace_lvar
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def replace_lvar(node, old_variable, new_variable)
if node.is_a?(Parser::AST::Node)
if node.type == :lvar && node.children.to_a == [old_variable]
node.updated(nil, [new_variable])
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
Method replace_send
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def replace_send(node, variable)
if node.is_a?(Parser::AST::Node)
if node.type == :send && node.children[0].nil?
node.updated(nil, [Parser::AST::Node.new(:lvar, [variable]), *node.children[1..]])
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
Method configuration
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def configuration
yaml_settings.merge(settings.deep_symbolize_keys).tap do |configuration|
configuration[:logger] = transport_logger if transport_logger
configuration[:indices_path] ||= indices_path if indices_path
configuration.merge!(tracer: transport_tracer) if transport_tracer
- 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
Method cleanup_default_scope!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def cleanup_default_scope!
behavior = Chewy.config.import_scope_cleanup_behavior
if behavior != :ignore && (@default_scope.arel.orders.present? ||
@default_scope.arel.limit.present? || @default_scope.arel.offset.present?)
- 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
Method compose
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def compose(object, crutches = nil, fields: [])
result = evaluate([object, crutches])
if children.present?
child_fields = if fields.present?
- 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
Method replace_local
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def replace_local(node, variable, local_index)
if node.is_a?(Parser::AST::Node)
if node.type == :send && node.children.to_a == [nil, variable]
node.updated(nil, [
Parser::AST::Node.new(:lvar, [:locals]),
- 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
Method perform
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def perform(type, score, options = {})
options[:refresh] = !Chewy.disable_refresh_async if Chewy.disable_refresh_async
::Sidekiq.redis do |redis|
timechunks_key = "#{Scheduler::KEY_PREFIX}:#{type}:timechunks"
- 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"