Class Element
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Element
module Structure
extend ActiveSupport::Concern
included do
- Create a ticketCreate a ticket
Method define_element_accessors
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def define_element_accessors(element)
name = element.name
if element.multiple?
# Define plural accessors
plural = element.plural
- Read upRead up
- Create a ticketCreate a ticket
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 element
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def element(name, options = {})
# Set name, type and element name by reference if provided
if name.is_a?(Hash)
options = name
name = nil
- Read upRead up
- Create a ticketCreate a ticket
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 define_element_accessors
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def define_element_accessors(element)
name = element.name
if element.multiple?
# Define plural accessors
plural = element.plural
- Create a ticketCreate a ticket
Method write_element
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def write_element(name, value, index = nil)
element = element_options(name)
type = element.type
unless value.is_a?(type)
value = if element.complex_type? && !value.is_a?(Nokogiri::XML::Node)
- Read upRead up
- Create a ticketCreate a ticket
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"