Method export_node_children
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def export_node_children(node, opts)
node.children.each do |child|
next if child.is_a?(Nokogiri::XML::Attr)
if child.is_a?(Nokogiri::XML::Element)
next if opts.drop_empty_elements? && empty?(child)
- 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 node_attributes
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def node_attributes(node, opts)
return {} unless node.respond_to?(:attributes)
attrs = node.attributes.values.select do |att|
next if opts.drop_undescribed_attributes? && !described?(att)
next if opts.drop_empty_attributes? && empty?(att)
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def export_element(node, opts)
opts = node_merged_opts(node, opts)
ns = node.namespace
if ns && !node_ns_definition(node, ns.prefix)
opts[:xml] = opts[:xml][ns.prefix] if ns.prefix
- 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"