Method cascadable_children
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def cascadable_children(kind, children = Set.new)
embedded_relations.each_pair do |name, association|
next unless association.cascading_callbacks?
without_autobuild do
delayed_pulls = delayed_atomic_pulls[name]
- 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 _mongoid_run_child_before_callbacks
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _mongoid_run_child_before_callbacks(kind, children: [], callback_list: [])
children.each do |child|
chain = child.__callbacks[child_callback_type(kind, child)]
env = ActiveSupport::Callbacks::Filters::Environment.new(child, false, nil)
next_sequence = compile_callbacks(chain)
- 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 run_callbacks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run_callbacks(kind, with_children: true, skip_if: nil, &block)
if skip_if&.call
return block&.call
end
if with_children
- 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 cascadable_child?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cascadable_child?(kind, child, association)
return false if kind == :initialize || kind == :find || kind == :touch
return false if kind == :validate && association.validate?
child.callback_executable?(kind) ? child.in_callback_state?(kind) : false
end
- 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 child_callback_type
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def child_callback_type(kind, child)
if kind == :update
return :create if child.new_record?
return :destroy if child.flagged_for_destroy?
kind
- 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"