twitter/twitter-cldr-rb

View on GitHub
lib/twitter_cldr/parsers/unicode_regex_parser.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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"
Severity: Minor
Found in lib/twitter_cldr/parsers/unicode_regex_parser.rb - About 3 hrs to fix

    Method preprocess has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def preprocess(tokens)
            result = []
            i = 0
    
            while i < tokens.size
    Severity: Minor
    Found in lib/twitter_cldr/parsers/unicode_regex_parser.rb - About 1 hr to fix

      Method preprocess has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def preprocess(tokens)
              result = []
              i = 0
      
              while i < tokens.size
      Severity: Minor
      Found in lib/twitter_cldr/parsers/unicode_regex_parser.rb - About 55 mins to fix

      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
      Severity: Minor
      Found in lib/twitter_cldr/parsers/unicode_regex_parser.rb - About 35 mins to fix

      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
      
      
      Severity: Minor
      Found in lib/twitter_cldr/parsers/unicode_regex_parser.rb - About 25 mins to fix

      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

      There are no issues that match your filters.

      Category
      Status