Class Literal
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Lexer::Literal
DELIMITERS = { '(' => ')', '[' => ']', '{' => '}', '<' => '>' }
SPACE = ' '.ord
TAB = "\t".ord
Method nest_and_try_closing
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def nest_and_try_closing(delimiter, ts, te, lookahead=nil)
delimiter = coerce_encoding(delimiter)
if @start_delim && @start_delim == delimiter
@nesting += 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 initialize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(lexer, str_type, delimiter, str_s, heredoc_e = nil,
indent = false, dedent_body = false, label_allowed = false)
@lexer = lexer
@nesting = 1
Method initialize
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(lexer, str_type, delimiter, str_s, heredoc_e = nil,
indent = false, dedent_body = false, label_allowed = false)
Method infer_indent_level
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def infer_indent_level(line)
return if !@dedent_body
indent_level = 0
line.each_char do |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 initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(lexer, str_type, delimiter, str_s, heredoc_e = nil,
indent = false, dedent_body = false, label_allowed = false)
@lexer = lexer
@nesting = 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"