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
- 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 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
- 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 redistribute
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def redistribute
table = @table
resize @size
i = 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"
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
- 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 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
- 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 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
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
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]
- 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
Avoid deeply nested control flow statements. Open
if item_hash = row[j]
add_item row[j+1], item_hash, row[j+2]
end
Avoid deeply nested control flow statements. Open
array[row[j+2]] = row[j+1] if row[j]
Method promote_row
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def promote_row(row, index, item, item_hash, ordinal)
Method set_item
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_item(table, index, item, item_hash, ordinal)