Class BulkBuilder
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class BulkBuilder
# @param index [Chewy::Index] desired index
# @param to_index [Array<Object>] objects to index
# @param delete [Array<Object>] objects or ids to delete
# @param fields [Array<Symbol, String>] and array of fields for documents update
Method index_entry
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def index_entry(object)
entry = {}
entry[:_id] = index_object_ids[object] if index_object_ids[object]
entry[:routing] = routing(object) if join_field?
- 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 parent_changed?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parent_changed?(data, old_parent)
return false unless old_parent
return false unless join_field?
return false unless @fields.include?(join_field.to_sym)
return false unless data.key?(join_field)
- 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 entry_id
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def entry_id(object)
if type_root.id
type_root.compose_id(object)
else
id = object.id if object.respond_to?(:id)
- 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 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 routing
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def routing(object)
# filter out non-model objects, early return on object==nil
return unless object.respond_to?(:id)
parent_id = find_parent_id(object)
- 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"