jdantonio/concurrent-ruby

View on GitHub

Showing 303 of 498 total issues

Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize(delayed, blockers_count, default_executor, executor, args, &task)
Severity: Minor
Found in lib/concurrent-ruby/concurrent/promises.rb - About 45 mins to fix

    Method reason has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

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

          def resolve_with(state, raise_on_reassign = true, reserved = false)
            if compare_and_set_internal_state(reserved ? RESERVED : PENDING, state)
              # go to synchronized block only if there were waiting threads
              @Lock.synchronize { @Condition.broadcast } unless @Waiters.value == 0
              call_callbacks state
    Severity: Minor
    Found in lib/concurrent-ruby/concurrent/promises.rb - About 45 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 ns_shift_message has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def ns_shift_message(matcher, remove = true)
            i = 0
            while true
              message = @Messages.fetch(i, NOTHING)
              return NOTHING if message == NOTHING
    Severity: Minor
    Found in lib/concurrent-ruby-edge/concurrent/edge/channel.rb - About 45 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

    Avoid deeply nested control flow statements.
    Open

                break if !running_writer?(c) && !running_readers?(c) && @Counter.compare_and_set(c, c+RUNNING_WRITER-WAITING_WRITER)
    Severity: Major
    Found in lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb - About 45 mins to fix

      Method link has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def link(pid)
              return true if pid == @Pid
              if @Linked.add? pid
                pid.tell Link.new(@Pid)
                if pid.terminated.resolved?
      Severity: Minor
      Found in lib/concurrent-ruby-edge/concurrent/edge/erlang_actor.rb - About 45 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

      Avoid deeply nested control flow statements.
      Open

                  elsif @Counter.compare_and_set(c, c+1)
                    @HeldCount.value = held + 1
                    return true
      Severity: Major
      Found in lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb - About 45 mins to fix

        Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def initialize(delayed, blockers_count, default_executor, executor, args, &task)
        Severity: Minor
        Found in lib/concurrent-ruby/concurrent/promises.rb - About 45 mins to fix

          Method push has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def push(message, timeout = nil)
                  pushed_op = @Mutex.synchronize do
                    return timeout ? true : self if ns_try_push(message)
          
                    pushed = Promises.resolvable_future
          Severity: Minor
          Found in lib/concurrent-ruby-edge/concurrent/edge/channel.rb - About 45 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 ns_initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def ns_initialize(opts)
                @min_length      = opts.fetch(:min_threads, DEFAULT_MIN_POOL_SIZE).to_i
                @max_length      = opts.fetch(:max_threads, DEFAULT_MAX_POOL_SIZE).to_i
                @idletime        = opts.fetch(:idletime, DEFAULT_THREAD_IDLETIMEOUT).to_i
                @max_queue       = opts.fetch(:max_queue, DEFAULT_MAX_QUEUE_SIZE).to_i
          Severity: Minor
          Found in lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb - About 45 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

          Avoid deeply nested control flow statements.
          Open

                          @ReadQueue.ns_wait if running_writer?
          Severity: Major
          Found in lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb - About 45 mins to fix

            Method take has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def take
                      mine = synchronize do
                        return Concurrent::NULL if ns_closed? && putting.empty?
            
                        ref = Concurrent::AtomicReference.new(nil)
            Severity: Minor
            Found in lib/concurrent-ruby-edge/concurrent/channel/buffer/unbuffered.rb - About 45 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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def initialize(delayed, blockers_count, default_executor, executor, args, &task)
            Severity: Minor
            Found in lib/concurrent-ruby/concurrent/promises.rb - About 45 mins to fix

              Method value has a Cognitive Complexity of 8 (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 45 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 compare_and_set has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def compare_and_set(expected_val, new_val, expected_mark, new_mark)
                    # Memoize a valid reference to the current AtomicReference for
                    # later comparison.
                    current             = reference
                    curr_val, curr_mark = current
              Severity: Minor
              Found in lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb - About 45 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 release_read_lock has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def release_read_lock
                    while true
                      c = @Counter.value
                      if @Counter.compare_and_set(c, c-1)
                        # If one or more writers were waiting, and we were the last reader, wake a writer up
              Severity: Minor
              Found in lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb - About 45 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 InstanceVariableSetVolatile has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                              ThreadContext context,
                              IRubyObject module,
                              IRubyObject self,
                              IRubyObject name,
                              IRubyObject value) {
              Severity: Minor
              Found in ext/concurrent-ruby/com/concurrent_ruby/ext/SynchronizationLibrary.java - About 35 mins to fix

                Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        def initialize(core, subsequent, core_options, trapping = false, terminate_children = true)
                Severity: Minor
                Found in lib/concurrent-ruby-edge/concurrent/actor/behaviour/termination.rb - About 35 mins to fix

                  Method define_struct_class has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        def self.define_struct_class(parent, base, name, members, &block)
                  Severity: Minor
                  Found in lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb - About 35 mins to fix

                    Method ruby_version has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                          def ruby_version(version = RUBY_VERSION, comparison, major, minor, patch)
                    Severity: Minor
                    Found in lib/concurrent-ruby/concurrent/utility/engine.rb - About 35 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language