Class IndentationManager
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class IndentationManager
include Tailor::LexerConstants
include Tailor::Logger::Mixin
# These are event names generated by the {Lexer} that signify
Method update_for_continuation_reason
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update_for_continuation_reason(token, lexed_line, lineno)
d_tokens = @indent_reasons.dup
d_tokens.pop
on_line_token = d_tokens.find { |t| t[:lineno] == lineno }
log "online token: #{on_line_token}"
- 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 method_missing
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(meth, *args, &blk)
if meth.to_s =~ /^multi_line_(.+)\?$/
token = case $1
when 'brackets' then '['
when 'braces' then '{'
- 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 in_an_enclosure?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def in_an_enclosure?
return false if @indent_reasons.empty?
i_reasons = @indent_reasons.dup
log "i reasons: #{i_reasons}"
- 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 remove_appropriate_reason
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def remove_appropriate_reason(closing_event_type)
if last_opening_event = last_opening_event(closing_event_type)
r_index = @indent_reasons.reverse.index(last_opening_event)
index = @indent_reasons.size - r_index - 1
tmp_reasons = []
- 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"