twitter/twitter-cldr-rb

View on GitHub
lib/twitter_cldr/shared/bidi.rb

Summary

Maintainability
F
5 days
Test Coverage

Method resolve_weak_types has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
Open

      def resolve_weak_types
        run_count = @runs.size
        previous_level = @base_embedding

        run_count.times do |run_idx|
Severity: Minor
Found in lib/twitter_cldr/shared/bidi.rb - About 1 day 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 compute_explicit_levels has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

      def compute_explicit_levels
        current_embedding = @base_embedding

        # The directional override is a Character directionality
        # constant.  -1 means there is no override.
Severity: Minor
Found in lib/twitter_cldr/shared/bidi.rb - About 6 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 resolve_neutral_types has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

      def resolve_neutral_types
        # This implements rules N1 and N2.
        run_count = get_run_count
        previous_level = @base_embedding

Severity: Minor
Found in lib/twitter_cldr/shared/bidi.rb - About 6 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

File bidi.rb has 345 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module TwitterCldr
  module Shared
    class Bidi
      attr_reader :types, :levels, :string_arr

Severity: Minor
Found in lib/twitter_cldr/shared/bidi.rb - About 4 hrs to fix

    Method compute_explicit_levels has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def compute_explicit_levels
            current_embedding = @base_embedding
    
            # The directional override is a Character directionality
            # constant.  -1 means there is no override.
    Severity: Major
    Found in lib/twitter_cldr/shared/bidi.rb - About 2 hrs to fix

      Method resolve_weak_types has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def resolve_weak_types
              run_count = @runs.size
              previous_level = @base_embedding
      
              run_count.times do |run_idx|
      Severity: Major
      Found in lib/twitter_cldr/shared/bidi.rb - About 2 hrs to fix

        Method reorder_visually! has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

              def reorder_visually!
                raise "No string given!" unless @string_arr
        
                # Do this explicitly so we can also find the maximum depth at the
                # same time.
        Severity: Minor
        Found in lib/twitter_cldr/shared/bidi.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 compute_paragraph_embedding_level has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

              def compute_paragraph_embedding_level
                # First check to see if the user supplied a directionality override.
                if [:LTR, :RTL].include?(@direction)
                  @direction == :LTR ? 0 : 1
                else
        Severity: Minor
        Found in lib/twitter_cldr/shared/bidi.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

        Method reinsert_formatting_codes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

              def reinsert_formatting_codes
                if @formatter_indices
                  input = @length
                  output = @levels.size
        
        
        Severity: Minor
        Found in lib/twitter_cldr/shared/bidi.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

        Method resolve_neutral_types has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def resolve_neutral_types
                # This implements rules N1 and N2.
                run_count = get_run_count
                previous_level = @base_embedding
        
        
        Severity: Minor
        Found in lib/twitter_cldr/shared/bidi.rb - About 1 hr to fix

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

                def reorder_visually!
                  raise "No string given!" unless @string_arr
          
                  # Do this explicitly so we can also find the maximum depth at the
                  # same time.
          Severity: Minor
          Found in lib/twitter_cldr/shared/bidi.rb - About 1 hr to fix

            Method resolve_implicit_levels has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def resolve_implicit_levels
                    # This implements rules I1 and I2.
                    @length.times do |i|
                      if (@levels[i] & 1) == 0
                        if @types[i] == :R
            Severity: Minor
            Found in lib/twitter_cldr/shared/bidi.rb - About 45 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 arraycopy has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def arraycopy(orig, orig_index, dest, dest_index, length)
            Severity: Minor
            Found in lib/twitter_cldr/shared/bidi.rb - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status