Showing 6 of 6 total issues
Method parse_item
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def parse_item
next_char = @scan.getch
if next_char == '['
parse_array
elsif next_char == '{'
- 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_item
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_item
next_char = @scan.getch
if next_char == '['
parse_array
elsif next_char == '{'
Method parse_hash
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def parse_hash
retval = {}
curr_key = nil
while !@scan.eos?
next_char = @scan.peek(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
Avoid deeply nested control flow statements. Open
if @scan.peek(1) == 'r'
get_chars(3)
true
else
Time.strptime(get_chars(19), '%Y-%m-%d %H:%M:%S')
Avoid deeply nested control flow statements. Open
elsif next_char == 'c'
BigDecimal(@scan.scan(/-?[0-9\.]+/))
elsif next_char == 'n'
get_chars(2)
nil
Method parse_array
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_array
retval = []
while !@scan.eos?
next_char = @scan.peek(1)
if next_char == ']'
- 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"