Class UnicodeRegexParser
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class UnicodeRegexParser < Parser
autoload :Component, "twitter_cldr/parsers/unicode_regex/component"
autoload :CharacterClass, "twitter_cldr/parsers/unicode_regex/character_class"
autoload :CharacterRange, "twitter_cldr/parsers/unicode_regex/character_range"
Method preprocess
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def preprocess(tokens)
result = []
i = 0
while i < tokens.size
Method preprocess
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def preprocess(tokens)
result = []
i = 0
while i < tokens.size
- 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 substitute_variables
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def substitute_variables(tokens, symbol_table)
return tokens unless symbol_table
tokens.inject([]) do |ret, token|
if token.type == :variable && sub = symbol_table.fetch(token.value)
# variables can themselves contain references to other variables
- 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 character_class
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def character_class
operator_stack = []
operand_stack = []
open_count = 0
- 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"