jdantonio/concurrent-ruby

View on GitHub

Showing 498 of 498 total issues

Avoid deeply nested control flow statements.
Open

                        if (busy == 0 && casBusy()) {
                            boolean created = false;
                            try {               // Recheck under lock
                                Cell[] rs; int m, j;
                                if ((rs = cells) != null &&

    Avoid deeply nested control flow statements.
    Open

                                            if (count >= TREE_THRESHOLD)
                                                replaceWithTreeBin(tab, i, k);

      Avoid deeply nested control flow statements.
      Open

                                  if ((pr = p.right) != null && h >= pr.hash && (r = getTreeNode(h, k, pr)) != null)
                                      return r;
                                  // try to continue iterating on the left side
                                  else if ((pl = p.left) != null && h <= pl.hash)
                                      dir = -1;

        Avoid deeply nested control flow statements.
        Open

                                            if ((e.val = v) == null) {
                                                deleted = true;
                                                Node en = e.next;
                                                if (pred != null)
                                                    pred.next = en;

          Avoid deeply nested control flow statements.
          Open

                                  for (Node e = tabAt(tab, i); e != null; e = e.next) {
                                      if (++c > TREE_THRESHOLD &&
                                              (e.key instanceof Comparable)) {
                                          replaceWithTreeBin(tab, i, e.key);
                                          break;

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

                @SuppressWarnings("unchecked") private void writeObject(java.io.ObjectOutputStream s)
                        throws java.io.IOException {
                    if (segments == null) { // for serialization compatibility
                        segments = (Segment<K,V>[])
                                new Segment<?,?>[DEFAULT_CONCURRENCY_LEVEL];

            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

                                        if ((pr = p.right) != null && h >= pr.hash && (r = getTreeNode(h, k, pr)) != null)
                                            return r;
                                        else // continue descending down the left subtree
                                            dir = -1;

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

              def para_prepare(&block)
                num_threads = $conf[:num_threads]
                count = $conf[:count_per_thread]
              
                if num_threads % 2 > 0
              Severity: Minor
              Found in examples/benchmark_atomic_1.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

                                                      if (count >= TREE_THRESHOLD)
                                                          replaceWithTreeBin(tab, i, k);

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

                      def ns_wait_until(timeout = nil, &condition)
                        if timeout
                          wait_until = Concurrent.monotonic_time + timeout
                          loop do
                            now = Concurrent.monotonic_time

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

                        def on_envelope(envelope)
                          command, reason = envelope.message
                          case command
                          when :terminated?
                            terminated?
                Severity: Minor
                Found in lib/concurrent-ruby-edge/concurrent/actor/behaviour/termination.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 consume_signal has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                      def consume_signal(message)
                        if AbstractSignal === message
                          case message
                          when Ask
                            @reply = message.probe
                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

                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
                        Severity
                        Category
                        Status
                        Source
                        Language