Method export_element_children
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def export_element_children(el, opts)
object_handlers(el, opts).each_with_object({}) do |h, memo|
obj = el[h.method_name]
if h.is_a?(Handlers::Element)
next if opts.drop_empty_elements? && empty?(obj)
- 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 object_handlers
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def object_handlers(el, opts)
handlers = []
if el.respond_to?(:__attributes_handlers)
el.__attributes_handlers.storage.each do |h|
next if opts.drop_undescribed_attributes? && !described?(h)
- 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 export_element
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def export_element(el, opts)
opts = node_merged_opts(el.__node, opts)
handlers = object_handlers(el, opts)
content = export_content(el, opts)
return content if handlers.size == 0
- 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"