Method start_element
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def start_element(name, attrs = [])
attrs = attrs.to_h
case name
when 'data'
- 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
File graphml.rb
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Rex
module Parser
#
# A partial implementation of the GraphML specification for loading structured data from an XML file. Notable
# missing components include GraphML parse meta-data (XML attributes with the "parse" prefix), hyperedges and ports.
Method start_element
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_element(name, attrs = [])
attrs = attrs.to_h
case name
when 'data'
Method populate_element_default_attributes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def populate_element_default_attributes(element)
@meta_attributes.values.each do |meta_attribute|
next unless meta_attribute.valid_for? element
next if element.attributes.key? meta_attribute.name
next if meta_attribute.default.nil?
- 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 characters
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def characters(string)
element = @stack[-1]
case element
when Element::Data
parent = @stack[-2]
- 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_element
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def end_element(name)
element = @stack.pop
populate_element_default_attributes(element) if element.is_a? AttributeContainer
- 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 from_xml_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.from_xml_attributes(xml_attrs)
id = xml_attrs['id']
raise Error::InvalidAttributeError.new('key', 'id') if id.nil?
name = xml_attrs['attr.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"