Showing 12 of 12 total issues
Method parse
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def parse(xml, options = {}) # Capture any provided namespaces and merge in any namespaces that have # been registered on the object. namespaces = options[:namespaces] || {} namespaces = namespaces.merge(@registered_namespaces)
- Read upRead up
Method parse
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(xml, options = {}) # Capture any provided namespaces and merge in any namespaces that have # been registered on the object. namespaces = options[:namespaces] || {} namespaces = namespaces.merge(@registered_namespaces)
Method element_to_xml
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def element_to_xml(element, xml, default_namespace) # # If an element is marked as read only do not consider at all when # saving to XML. #
- Read upRead up
Method collect_writable_attributes
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def collect_writable_attributes # # Find the attributes for the class and collect them into an array # that will be placed into a Hash structure #
- Read upRead up
Method define_element_on_class
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def define_element_on_class(klass, node) # When a text node has been provided create the necessary # HappyMapper content attribute if the text happens to contain # some content.
- Read upRead up
Method handle_attributes_option
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def handle_attributes_option(result, value, xpath_options) return unless options[:attributes].is_a?(Hash) result = result.first unless result.respond_to?(:attribute_nodes) return unless result.respond_to?(:attribute_nodes)
- Read upRead up
Method find_nodes_to_parse
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def find_nodes_to_parse(options, namespace, tag_name, namespaces, node, root) # when at the root use the xpath '/' otherwise use a more gready './/' # unless an xpath has been specified, which should overwrite default # and finally attach the current namespace if one has been defined xpath = if options[:xpath]
- Read upRead up
Method find
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def find(node, namespace, xpath_options) if self.namespace # from the class definition namespace = self.namespace elsif options[:namespace]
- Read upRead up
Method element_to_xml
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def element_to_xml(element, xml, default_namespace) # # If an element is marked as read only do not consider at all when # saving to XML. #
Method to_xml
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def to_xml(builder = nil, default_namespace = nil, namespace_override = nil, tag_from_parent = nil) # # If to_xml has been called without a passed in builder instance that # means we are going to return xml output. When it has been called with
- Read upRead up
Method find_nodes_to_parse
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def find_nodes_to_parse(options, namespace, tag_name, namespaces, node, root)
Method parse_node
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_node(node, options, namespace, namespaces) # If an existing HappyMapper object is provided, update it with the # values from the xml being parsed. Otherwise, create a new object obj = options[:update] || new
- Read upRead up