Method hash_decode
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def hash_decode(value)
case value
when Hash
r = nil
if value.size == 1
- 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 hash_decode
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def hash_decode(value)
case value
when Hash
r = nil
if value.size == 1
Avoid deeply nested control flow statements. Open
members = [members] unless members.is_a?(Array)
Avoid deeply nested control flow statements. Open
values = [values] unless values.is_a?(Array)
Method parse_method_response
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_method_response(xml)
parsing_xml = Encoder.hash_decode(Hash.from_xml(xml))
fail 'No valid method response!' if parsing_xml['methodName']
parsing_xml = parsing_xml['methodResponse']
if parsing_xml['fault']
- 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 hash_encode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def hash_encode(value)
{
value:
case value
when Integer
- 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"