rubinius/rubinius

View on GitHub
core/identity_map.rb

Summary

Maintainability
D
2 days
Test Coverage

Method insert has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def insert(item, &block)
      redistribute if @size > @max

      if block_given?
        item_hash = yield(item).hash
Severity: Minor
Found in core/identity_map.rb - About 3 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 to_array has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def to_array
      array = Array.new @size

      i = 0
      table = @table
Severity: Minor
Found in core/identity_map.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 redistribute has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def redistribute
      table = @table
      resize @size

      i = 0
Severity: Minor
Found in core/identity_map.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 delete has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def delete(item)
      item_hash = item.hash

      index = item_hash & @mask
      table = @table
Severity: Minor
Found in core/identity_map.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 include? has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def include?(item)
      item_hash = item.hash

      index = item_hash & @mask
      table = @table
Severity: Minor
Found in core/identity_map.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 insert has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def insert(item, &block)
      redistribute if @size > @max

      if block_given?
        item_hash = yield(item).hash
Severity: Minor
Found in core/identity_map.rb - About 1 hr to fix

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

        def delete(item)
          item_hash = item.hash
    
          index = item_hash & @mask
          table = @table
    Severity: Minor
    Found in core/identity_map.rb - About 1 hr to fix

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

          def add_item(item, item_hash, ordinal)
            index = item_hash & @mask
            table = @table
      
            if num_entries = table[index]
      Severity: Minor
      Found in core/identity_map.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

      Avoid deeply nested control flow statements.
      Open

                    if item_hash = row[j]
                      add_item row[j+1], item_hash, row[j+2]
                    end
      Severity: Major
      Found in core/identity_map.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                      array[row[j+2]] = row[j+1] if row[j]
        Severity: Major
        Found in core/identity_map.rb - About 45 mins to fix

          Method promote_row has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def promote_row(row, index, item, item_hash, ordinal)
          Severity: Minor
          Found in core/identity_map.rb - About 35 mins to fix

            Method set_item has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def set_item(table, index, item, item_hash, ordinal)
            Severity: Minor
            Found in core/identity_map.rb - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status