lib/maruku/input/charsource.rb
Method method_missing
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def method_missing(methodname, *args)
a_bef = @a.describe
b_bef = @b.describe
a = @a.send(methodname, *args)
Method describe
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def describe
len = 75
num_before = [len/2, @scanner.pos].min
num_after = [len/2, @scanner.rest_size].min
num_before_max = @scanner.pos
Method describe_pos
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def describe_pos(buffer, buffer_index)
len = 75
num_before = [len/2, buffer_index].min
num_after = [len/2, buffer.size - buffer_index].min
num_before_max = buffer_index
Method consume_whitespace
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def consume_whitespace
while c = cur_char
break unless (c == ' ' || c == "\t")
ignore_char
end
- 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"