twitter/twitter-cldr-rb

View on GitHub
lib/twitter_cldr/segmentation/brahmic_break_engine.rb

Summary

Maintainability
C
1 day
Test Coverage

Method mark_best_candidate has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

      def mark_best_candidate(cursor, end_pos, state)
        # if there was more than one, see which one can take us forward the most words
        found_best = false

        # if we're already at the end of the range, we're done
Severity: Minor
Found in lib/twitter_cldr/segmentation/brahmic_break_engine.rb - About 4 hrs 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 divide_up_dictionary_range has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

      def divide_up_dictionary_range(cursor, end_pos)
        return to_enum(__method__, cursor, end_pos) unless block_given?
        return if (end_pos - cursor.position) < min_word_span

        state = EngineState.new(
Severity: Minor
Found in lib/twitter_cldr/segmentation/brahmic_break_engine.rb - About 2 hrs 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 divide_up_dictionary_range has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def divide_up_dictionary_range(cursor, end_pos)
        return to_enum(__method__, cursor, end_pos) unless block_given?
        return if (end_pos - cursor.position) < min_word_span

        state = EngineState.new(
Severity: Minor
Found in lib/twitter_cldr/segmentation/brahmic_break_engine.rb - About 1 hr to fix

    Method advance_to_plausible_word_boundary has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def advance_to_plausible_word_boundary(cursor, end_pos, state)
            remaining = end_pos - (state.current + state.word_length)
            pc = cursor.codepoint
            chars = 0
    
    
    Severity: Minor
    Found in lib/twitter_cldr/segmentation/brahmic_break_engine.rb - About 1 hr 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