Showing 4 of 4 total issues
Class Document
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Document < BlankSlate
# Create an Excemel Document
# The method expects a hash that contain the possible elements
# :root => value : The name of the root or top-most element of the document
Method _process_args
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _process_args(args, sym)
attrs, namespace, text = nil
prefix = _extract_prefix(sym)
args.each do |arg|
case arg
- 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 _add_attributes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _add_attributes(target, attrs)
if attrs
attrs.each do |key, value|
unless value.nil?
attribute = XOM::Attribute.new(key.to_s, value.to_s)
- 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 _build_document_from_root
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _build_document_from_root(root, namespace)
@root = _build_tag(root, namespace)
if namespace
prefix = root.to_s.split(":").first if root.include? ":"
(@namespaces ||= {})[prefix] = namespace if 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"