Showing 81 of 88 total issues
Method slice
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def slice(arg, length = (missing_length = true))
if missing_length
if arg.is_a?(Range)
from, to = arg.begin, arg.end
from += size if from < 0
Method repeated_permutation
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def repeated_permutation(n = @size)
return enum_for(:repeated_permutation, n) if not block_given?
if n < 0
# yield nothing
elsif n == 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 realize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def realize
# another thread may get ahead of us and null out @mutex
mutex = @mutex
mutex && mutex.synchronize do
return if @head != Undefined # another thread got ahead of us
- 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 realize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def realize
# another thread may get ahead of us and null out @mutex
mutex = @mutex
mutex && mutex.synchronize do
return if @head != Undefined # another thread got ahead of us
- 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 from
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def from(obj)
case obj
when ::Hash
res = obj.map { |key, value| [from(key), from(value)] }
Hamster::Hash.new(res)
- 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 fill
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def fill(obj, index = 0, length = nil)
if index == 0
length ||= size
if length > 0
LazyList.new do
- 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 realize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def realize
while true
# try to "claim" the right to run the block which realizes target
if @atomic.compare_and_swap(0,1) # full memory barrier here
begin
Method delete
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def delete(item)
dir = direction(item)
if dir == 0
if @right.empty?
return @left # replace this node with its only child
- 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 find_and_delete
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find_and_delete(key)
index = index_for(key)
entry = @entries[index]
if entry && entry[0].eql?(key)
return delete_at(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
Method replace_suffix
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def replace_suffix(from, suffix)
# new suffix can go directly after existing elements
raise IndexError if from > @size
root, levels = @root, @levels
- 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 flatten_suffix
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def flatten_suffix(node, bitshift, from, result)
from_slot = (from >> bitshift) & INDEX_MASK
if bitshift == 0
if from_slot == 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 find_index
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find_index(obj = (missing_obj = true), &block)
if !missing_obj
# Enumerable provides a default implementation, but this is more efficient
node = @node
index = node.left.size
- 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 intersection
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def intersection(other)
if other.size < @trie.size
if other.is_a?(Hamster::Set)
trie = other.instance_variable_get(:@trie).select { |key, _| include?(key) }
else
- 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_at
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def delete_at(index)
if index == 0
tail
elsif index < 0
index += size if index < 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 realize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def realize
mutex = @mutex
mutex && mutex.synchronize do
return if @head != Undefined
@splitter.next_item until @splitter.done?
- 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 flat_map
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def flat_map(&block)
return enum_for(:flat_map) unless block_given?
LazyList.new do
next self if empty?
head_list = List.from_enum(yield(head))
- 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 take_while
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def take_while(&block)
return enum_for(:take_while) unless block_given?
LazyList.new do
next self if empty?
next Cons.new(head, tail.take_while(&block)) if yield(head)
- 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 disjoint?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def disjoint?(other)
if size < other.size
each { |item| return false if other.include?(item) }
else
other.each { |item| return false if include?(item) }
- 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 union
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def union(other)
if other.is_a?(Hamster::Set)
if other.size > size
small_set_pairs = @trie
large_set_trie = other.instance_variable_get(:@trie)
- 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 eql?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def eql?(other)
return true if equal?(other)
return false unless instance_of?(other.class) && size == other.size
each do |entry|
return false unless other.include?(entry[0], entry[1])
- 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"