Method mcp_parse
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mcp_parse(stream)
# Reminder: this has to be an array, not a hash, because there are
# often duplicate entries (like multiple userdb_entry results when a
# query is performed).
result = []
Method mcp_build
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def mcp_build(tag, type, data)
if @tags_by_name[tag].nil?
raise "Invalid mcp tag: #{tag}"
end
if @tags_by_name[type].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 mcp_build
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mcp_build(tag, type, data)
if @tags_by_name[tag].nil?
raise "Invalid mcp tag: #{tag}"
end
if @tags_by_name[type].nil?
Method mcp_parse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def mcp_parse(stream)
# Reminder: this has to be an array, not a hash, because there are
# often duplicate entries (like multiple userdb_entry results when a
# query is performed).
result = []
- 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 mcp_send_recv
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def mcp_send_recv(messages)
# Attach headers to each message and combine them
message = messages.map do |m|
[m.length, 0, 0, 0, m].pack('NNNNa*')
end.join('')
- 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"