jdantonio/concurrent-ruby

View on GitHub

Showing 303 of 498 total issues

Method putTreeNode has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        @SuppressWarnings("unchecked") final TreeNode putTreeNode
        (int h, RubyObject k, Object v) {
            RubyClass c = k.getMetaClass();
            boolean kNotComparable = !k.respondsTo("<=>");
            TreeNode pp = root, p = null;

    JRubyMapBackend has 30 methods (exceeds 20 allowed). Consider refactoring.
    Open

      @JRubyClass(name="JRubyMapBackend", parent="Object")
        public static class JRubyMapBackend extends RubyObject {
          // Defaults used by the CHM
          static final int DEFAULT_INITIAL_CAPACITY = 16;
          static final float DEFAULT_LOAD_FACTOR = 0.75f;

      Class AbstractActor has 30 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class AbstractActor < Synchronization::Object
      
            include EnvironmentConstants
            include Concern::Logging
            safe_initialization!
      Severity: Minor
      Found in lib/concurrent-ruby-edge/concurrent/edge/erlang_actor.rb - About 3 hrs to fix

        Method compute_physical_processor_count has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

              def compute_physical_processor_count
                ppc = case RbConfig::CONFIG["target_os"]
                      when /darwin\d\d/
                        IO.popen("/usr/sbin/sysctl -n hw.physicalcpu", &:read).to_i
                      when /linux/
        Severity: Minor
        Found in lib/concurrent-ruby/concurrent/utility/processor_counter.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 internalReplace has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private final Object internalReplace(Object k, Object v, Object cv) {
                int h = spread(k.hashCode());
                Object oldVal = null;
                for (Node[] tab = table;;) {
                    Node f; int i, fh; Object fk;

          Method internalReplace has 89 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private final Object internalReplace(Object k, Object v, Object cv) {
                  int h = spread(k.hashCode());
                  Object oldVal = null;
                  for (AtomicReferenceArray<Node> tab = table;;) {
                      Node f; int i, fh; Object fk;

            Method tryAwaitLock has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                    final void tryAwaitLock(Node[] tab, int i) {
                        if (tab != null && i >= 0 && i < tab.length) { // sanity check
                            int r = ThreadLocalRandom.current().nextInt(); // randomize spins
                            int spins = MAX_SPINS, h;
                            while (tabAt(tab, i) == this && ((h = hash) & LOCKED) != 0) {

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

                    final void tryAwaitLock(AtomicReferenceArray<Node> tab, int i) {
                        if (tab != null && i >= 0 && i < tab.length()) { // sanity check
                            int r = ThreadLocalRandom.current().nextInt(); // randomize spins
                            int spins = MAX_SPINS, h;
                            while (tabAt(tab, i) == this && ((h = hash) & LOCKED) != 0) {

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

                    def retry_update(x, hash_code, was_uncontended) # :yields: current_value
                      hash     = hash_code
                      collided = false # True if last slot nonempty
                      while true
                        if current_cells = cells
            Severity: Minor
            Found in lib/concurrent-ruby/concurrent/thread_safe/util/striped64.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 Agent has 28 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class Agent < Synchronization::LockableObject
                include Concern::Observable
            
                ERROR_MODES = [:continue, :fail].freeze
                private_constant :ERROR_MODES
            Severity: Minor
            Found in lib/concurrent-ruby/concurrent/agent.rb - About 3 hrs to fix

              Method internalPut has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private final Object internalPut(Object k, Object v) {
                      int h = spread(k.hashCode());
                      int count = 0;
                      for (AtomicReferenceArray<Node> tab = table;;) {
                          int i; Node f; int fh; Object fk;

                Method internalPut has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private final Object internalPut(Object k, Object v) {
                        int h = spread(k.hashCode());
                        int count = 0;
                        for (Node[] tab = table;;) {
                            int i; Node f; int fh; Object fk;

                  Method ask has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def ask(message, timeout, timeout_value)
                          log DEBUG, @Pid, asked: message
                          if @Terminated.resolved?
                            raise NoActor.new(@Pid)
                          else
                  Severity: Minor
                  Found in lib/concurrent-ruby-edge/concurrent/edge/erlang_actor.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 RubyThreadPoolExecutor has 27 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class RubyThreadPoolExecutor < RubyExecutorService
                  
                      # @!macro thread_pool_executor_constant_default_max_pool_size
                      DEFAULT_MAX_POOL_SIZE      = 2_147_483_647 # java.lang.Integer::MAX_VALUE
                  
                  
                  Severity: Minor
                  Found in lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb - About 3 hrs to fix

                    Method inner_run has a Cognitive Complexity of 22 (exceeds 5 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 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 Promise has 26 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                      class Promise < IVar
                    
                        # Initialize a new Promise with the provided options.
                        #
                        # @!macro executor_and_deref_options
                    Severity: Minor
                    Found in lib/concurrent-ruby/concurrent/promise.rb - About 3 hrs to fix

                      Method retryUpdate has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          final void retryUpdate(long x, HashCode hc, boolean wasUncontended) {
                              int h = hc.code;
                              boolean collide = false;                // True if last slot nonempty
                              for (;;) {
                                  Cell[] as; Cell a; int n; long v;
                      Severity: Major
                      Found in ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/Striped64.java - About 2 hrs to fix

                        Method retryUpdate has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            final void retryUpdate(long x, HashCode hc, boolean wasUncontended) {
                                int h = hc.code;
                                boolean collide = false;                // True if last slot nonempty
                                for (;;) {
                                    Cell[] as; Cell a; int n; long v;

                          Method tryPresize has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private final void tryPresize(int size) {
                                  int c = (size >= (MAXIMUM_CAPACITY >>> 1)) ? MAXIMUM_CAPACITY :
                                          tableSizeFor(size + (size >>> 1) + 1);
                                  int sc;
                                  while ((sc = sizeCtl) >= 0) {

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

                              private final void tryPresize(int size) {
                                  int c = (size >= (MAXIMUM_CAPACITY >>> 1)) ? MAXIMUM_CAPACITY :
                                          tableSizeFor(size + (size >>> 1) + 1);
                                  int sc;
                                  while ((sc = sizeCtl) >= 0) {

                          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