Showing 81 of 88 total issues
File list.rb
has 767 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "thread"
require "set"
require "concurrent/atomics"
require "hamster/undefined"
File sorted_set.rb
has 742 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "hamster/immutable"
require "hamster/enumerable"
module Hamster
File vector.rb
has 665 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "hamster/immutable"
require "hamster/enumerable"
require "hamster/hash"
require "hamster/associable"
Class Vector
has 67 methods (exceeds 20 allowed). Consider refactoring. Open
class Vector
include Immutable
include Enumerable
include Associable
Class SortedSet
has 53 methods (exceeds 20 allowed). Consider refactoring. Open
class SortedSet
include Immutable
include Enumerable
class << self
Class Hash
has 52 methods (exceeds 20 allowed). Consider refactoring. Open
class Hash
include Immutable
include Enumerable
include Associable
Method slice
has a Cognitive Complexity of 38 (exceeds 5 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
- 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
Class Set
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class Set
include Immutable
include Enumerable
class << self
Method bulk_put
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def bulk_put(key_value_pairs)
new_entries = nil
new_children = nil
new_size = @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
Class AVLNode
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class AVLNode
def self.from_items(items, comparator, from = 0, to = items.size-1) # items must be sorted
size = to - from + 1
if size >= 3
middle = (to + from) / 2
Method replace_node_suffix
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def replace_node_suffix(node, bitshift, from, suffix)
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 bulk_delete
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def bulk_delete(keys)
new_entries = nil
new_children = nil
new_size = @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
Class Empty
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Empty
def initialize(comparator); @comparator = comparator; end
def natural_order?; false; end
def left; self; end
def right; self; end
Method product
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def product(*vectors)
# if no vectors passed, return "product" as in result of multiplying all items
return super if vectors.empty?
vectors.unshift(self)
- 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
File hash.rb
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "hamster/immutable"
require "hamster/undefined"
require "hamster/enumerable"
require "hamster/trie"
require "hamster/set"
Method put
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def put(key, value)
index = index_for(key)
entry = @entries[index]
if !entry
- 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 slice
has a Cognitive Complexity of 19 (exceeds 5 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
- 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 slice
has a Cognitive Complexity of 19 (exceeds 5 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 += @node.size if from < 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
File trie.rb
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Hamster
# @private
class Trie
def self.[](pairs)
result = self.new(0)
Method _uniq
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _uniq(items, &block)
if block_given?
LazyList.new do
next self if empty?
if items.add?(block.call(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"