Method parse_one
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def parse_one(char, for_array: false)
res = nil
case char
when "a"
res = Type.new(ARRAY)
- 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
File type.rb
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
module DBus
# Like a {Signature} but containing only a single complete type.
#
# For documentation purposes only.
class SingleCompleteType < String; end
Method parse_one
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_one(char, for_array: false)
res = nil
case char
when "a"
res = Type.new(ARRAY)
Method <<
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def <<(item)
raise ArgumentError unless item.is_a?(Type)
if ![STRUCT, ARRAY, DICT_ENTRY].member?(@sigtype)
raise SignatureException
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(sigtype, abstract: false)
if !TYPE_MAPPING.keys.member?(sigtype)
case sigtype
when ")"
raise SignatureException, "STRUCT unexpectedly closed: )"
- 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"