hamstergem/hamster

View on GitHub
lib/hamster/hash.rb

Summary

Maintainability
C
1 day
Test Coverage

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

    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 merge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def merge(other)
            trie = if block_given?
              other.reduce(@trie) do |trie, (key, value)|
                if entry = trie.get(key)
                  trie.put(key, yield(key, entry[1], value))
      Severity: Minor
      Found in lib/hamster/hash.rb - About 25 mins 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 derive_new_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def derive_new_hash(trie)
            if trie.equal?(@trie)
              self
            elsif trie.empty?
              if @default
      Severity: Minor
      Found in lib/hamster/hash.rb - About 25 mins 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

      There are no issues that match your filters.

      Category
      Status