piotrmurach/splay_tree

View on GitHub

Showing 4 of 4 total issues

Method splay has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def splay(key)
current = @root
dummy = left = right = @subtree
@subtree.left = @subtree.right = Node::EMPTY
loop do
Severity: Minor
Found in lib/splay_tree.rb - About 4 hrs to fix

Method splay has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def splay(key)
current = @root
dummy = left = right = @subtree
@subtree.left = @subtree.right = Node::EMPTY
loop do
Severity: Minor
Found in lib/splay_tree.rb - About 1 hr to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    break if current.left.empty?
     
    if key < current.left.key
    current = current.rotate_right
    break if current.left.empty?
    Severity: Minor
    Found in lib/splay_tree.rb and 1 other location - About 25 mins to fix
    lib/splay_tree.rb on lines 278..286

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    break if current.right.empty?
     
    if key > current.right.key
    current = current.rotate_left
    break if current.right.empty?
    Severity: Minor
    Found in lib/splay_tree.rb and 1 other location - About 25 mins to fix
    lib/splay_tree.rb on lines 268..276
    Severity
    Category
    Status
    Source
    Language