Showing 2 of 2 total issues
Method deliver!
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
def deliver!
raise FromMissing, 'The value for the from attribute is missing.' unless sender_present?
raise FromTooLong, 'The value for the sender attribute must contain 1..11 characters.' unless sender_length?
raise ToMissing, 'The value for the to attribute is missing.' unless receiver_present?
raise BodyMissing, 'The body of the message is missing.' unless body_present?
- 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 to_xml
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def to_xml
builder = Builder::XmlMarkup.new
builder.instruct! :xml, version: '1.0'
builder.MESSAGES do |m|
m.AUTHENTICATION do |authentication|
- 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"