jdantonio/concurrent-ruby

View on GitHub

Showing 303 of 498 total issues

Class Map has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Map < Collection::MapImplementation

    # @!macro map.atomic_method
    #   This method is atomic.

Severity: Minor
Found in lib/concurrent-ruby/concurrent/map.rb - About 2 hrs to fix

    Method acquire has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def acquire(timeout = nil, &block)
          event = acquire_or_event
          if event
            within_timeout = event.wait(timeout)
            # release immediately when acquired later after the timeout since it is unused
    Severity: Minor
    Found in lib/concurrent-ruby-edge/concurrent/edge/throttle.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 demonitor has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

          def demonitor(reference, *options)
            info  = options.delete :info
            flush = options.delete :flush
            raise ArgumentError, "bad options #{options}" unless options.empty?
    
    
    Severity: Minor
    Found in lib/concurrent-ruby-edge/concurrent/edge/erlang_actor.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 atomically has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def atomically
        raise ArgumentError.new('no block given') unless block_given?
    
        # Get the current transaction
    
    
    Severity: Minor
    Found in lib/concurrent-ruby/concurrent/tvar.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 acquire_read_lock has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def acquire_read_lock
          while true
            c = @Counter.value
            raise ResourceLimitError.new('Too many reader threads') if max_readers?(c)
    
    
    Severity: Minor
    Found in lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb - About 1 hr 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 execute has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

          def execute
            raise Channel::Error.new('no clauses given') if @clauses.empty?
            loop do
              done = @clauses.each do |clause|
                result = clause.execute
    Severity: Minor
    Found in lib/concurrent-ruby-edge/concurrent/channel/selector.rb - About 1 hr 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 compare_and_set has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def compare_and_set(old_value, new_value)
          if old_value.kind_of? Numeric
            while true
              old = get
    
    

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

            @SuppressWarnings("unchecked") public final <T> T[] toArray(T[] a) {
                long sz = map.mappingCount();
                if (sz > (long)(MAX_ARRAY_SIZE))
                    throw new OutOfMemoryError(oomeMsg);
                int m = (int)sz;

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

            @SuppressWarnings("unchecked") public final <T> T[] toArray(T[] a) {
                long sz = map.mappingCount();
                if (sz > (long)(MAX_ARRAY_SIZE))
                    throw new OutOfMemoryError(oomeMsg);
                int m = (int)sz;

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

          def consume_exit(exit_message)
            from, reason = exit_message
            if !exit_message.link_terminated || @Linked.delete(from)
              case reason
              when :normal
    Severity: Minor
    Found in lib/concurrent-ruby-edge/concurrent/edge/erlang_actor.rb - About 1 hr 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 ns_try_push has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

          def ns_try_push(message)
            i = 0
            while true
              probe, include_channel, matcher = @Probes[i, 3]
              break unless probe
    Severity: Minor
    Found in lib/concurrent-ruby-edge/concurrent/edge/channel.rb - About 1 hr 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 inner_run has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def inner_run(*args, &body)
            first       = !!body
            future_body = -> message, _actor do
              kind, reason, value =
                  if message.is_a?(::Array) && message.first == TERMINATE
    Severity: Minor
    Found in lib/concurrent-ruby-edge/concurrent/edge/erlang_actor.rb - About 1 hr to fix

      Method wait has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def wait(timeout = nil)
            synchronize do
      
              return false unless @generation.status == :waiting
      
      
      Severity: Minor
      Found in lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb - About 1 hr 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 then has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def then(*args, &block)
            if args.last.is_a?(::Hash)
              executor = args.pop[:executor]
              rescuer = args.first
            else
      Severity: Minor
      Found in lib/concurrent-ruby/concurrent/promise.rb - About 1 hr 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 ns_initialize has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def ns_initialize(opts, &block)
              @mailbox              = ::Array.new
              @serialized_execution = SerializedExecution.new
              @children             = Set.new
      
      
      Severity: Minor
      Found in lib/concurrent-ruby-edge/concurrent/actor/core.rb - About 1 hr 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 []= has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def []=(member, value)
            if member.is_a? Integer
              length = synchronize { @values.length }
              if member >= length
                raise IndexError.new("offset #{member} too large for struct(size:#{length})")
      Severity: Minor
      Found in lib/concurrent-ruby/concurrent/settable_struct.rb - About 1 hr 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 swap has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def swap(*args)
            raise ArgumentError.new('no block given') unless block_given?
      
            loop do
              old_value = value
      Severity: Minor
      Found in lib/concurrent-ruby/concurrent/atom.rb - About 1 hr 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 value! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def value!(timeout = nil, timeout_value = nil, resolve_on_timeout = nil)
              if wait_until_resolved! timeout
                internal_state.value
              else
                if resolve_on_timeout
      Severity: Minor
      Found in lib/concurrent-ruby/concurrent/promises.rb - About 1 hr 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 receive has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def receive(*rules, timeout: nil, timeout_value: nil, &given_block)
              clean_reply
      
              err = canonical_rules rules, timeout, timeout_value, given_block
              raise err if err
      Severity: Minor
      Found in lib/concurrent-ruby-edge/concurrent/edge/erlang_actor.rb - About 1 hr 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 pop has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def pop
            # retry until some value can be returned
            while true
              # the value in @head is just a dummy node that always sits in that position,
              # the real 'head' is in its successor
      Severity: Minor
      Found in lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb - About 1 hr 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