hamstergem/hamster

View on GitHub

Showing 88 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"
Severity: Major
Found in lib/hamster/list.rb - About 1 day to fix

    File sorted_set.rb has 742 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "hamster/immutable"
    require "hamster/enumerable"
    
    module Hamster
    
    
    Severity: Major
    Found in lib/hamster/sorted_set.rb - About 1 day to fix

      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"
      
      
      Severity: Major
      Found in lib/hamster/vector.rb - About 1 day to fix

        Class Vector has 67 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Vector
            include Immutable
            include Enumerable
            include Associable
        
        
        Severity: Major
        Found in lib/hamster/vector.rb - About 1 day to fix

          Class SortedSet has 53 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class SortedSet
              include Immutable
              include Enumerable
          
              class << self
          Severity: Major
          Found in lib/hamster/sorted_set.rb - About 7 hrs to fix

            Class Hash has 52 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class Hash
                include Immutable
                include Enumerable
                include Associable
            
            
            Severity: Major
            Found in lib/hamster/hash.rb - About 7 hrs to fix

              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
              Severity: Minor
              Found in lib/hamster/list.rb - About 5 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

              Class Set has 37 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class Set
                  include Immutable
                  include Enumerable
              
                  class << self
              Severity: Minor
              Found in lib/hamster/set.rb - About 4 hrs to fix

                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
                
                
                Severity: Minor
                Found in lib/hamster/trie.rb - About 4 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

                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
                Severity: Minor
                Found in lib/hamster/sorted_set.rb - About 4 hrs to fix

                  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
                  Severity: Minor
                  Found in lib/hamster/vector.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 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
                  
                  
                  Severity: Minor
                  Found in lib/hamster/trie.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

                  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
                  Severity: Minor
                  Found in lib/hamster/sorted_set.rb - About 3 hrs to fix

                    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)
                    Severity: Minor
                    Found in lib/hamster/vector.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

                    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"
                    Severity: Minor
                    Found in lib/hamster/hash.rb - About 3 hrs to fix

                      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
                      Severity: Minor
                      Found in lib/hamster/trie.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 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
                      Severity: Minor
                      Found in lib/hamster/vector.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 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
                      Severity: Minor
                      Found in lib/hamster/sorted_set.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

                      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)
                      Severity: Minor
                      Found in lib/hamster/trie.rb - About 2 hrs to fix

                        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))
                        Severity: Minor
                        Found in lib/hamster/list.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

                        Severity
                        Category
                        Status
                        Source
                        Language