Showing 6 of 6 total issues
Method initialize
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def initialize(parent, name, attributes, &contents)
@is_name_space = false
@children = []
@parent = parent
if attributes.is_a?(Array)
- 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 initialize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(parent, name, attributes, &contents)
@is_name_space = false
@children = []
@parent = parent
if attributes.is_a?(Array)
Method append_attributes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def append_attributes(node)
return if node.name == 'xml' || node.name_space_context?
# Glimmer::Config.logger&.debug "Append Attributes"
# Glimmer::Config.logger&.debug(node.attributes)
node.attributes.each do |attribute, value|
- 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_content
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def add_content(parent, keyword, *args, &block)
return_value = block.call(parent)
if !return_value.is_a?(Glimmer::XML::Node) and !parent.children.include?(return_value)
text = return_value.to_s
first_match = text.match(/[#][^{]+[{][^}]+[}]/)
- 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 render_html_tag?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def render_html_tag?(node)
if node.name == 'html'
node_children = node.children.select {|node_or_text| node_or_text.is_a?(Glimmer::XML::Node)}
if !node_children.empty?
children_names = node_children.map(&: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 end_open_tag
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def end_open_tag(node)
return if node.name == 'xml' || node.name_space_context?
if (node.contents)
@document += ">"
else
- 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"