Showing 6 of 6 total issues
Method parse_message
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def parse_message(raw)
return if raw.length == 0
# Mark this message as processed, including the 4 stripped cr/lf bytes
@processed += raw.length
- 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 parse_message
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_message(raw)
return if raw.length == 0
# Mark this message as processed, including the 4 stripped cr/lf bytes
@processed += raw.length
Method message_received
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def message_received(message)
logger.trace "[RECV] #{message.inspect}"
case message
when Event
action = causal_action_for_event message
- 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 <<
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def <<(message)
case message
when Error
self.response = message
complete!
- 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 parse_buffer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_buffer
# Special case for the protocol header
if @buffer =~ PROMPT
@ami_version = $1
@buffer.slice! HEADER_SLICE
- 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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(host, port, username, password, event_callback, logger = Logger, timeout = 0)