jdantonio/concurrent-ruby

View on GitHub

Showing 303 of 498 total issues

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

    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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def initialize(core, subsequent, core_options, handle, strategy)
      Severity: Minor
      Found in lib/concurrent-ruby-edge/concurrent/actor/behaviour/supervising.rb - About 35 mins to fix

        Method getValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                final Object getValue(int h, Object k) {
                    Node r = null;
                    int c = getState(); // Must read lock state first
                    for (Node e = first; e != null; e = e.next) {
                        if (c <= 0 && compareAndSetState(c, c - 1)) {

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

            private static void splitBin(AtomicReferenceArray<Node> nextTab, int i, Node e) {
                int bit = nextTab.length() >>> 1; // bit to split on
                int runBit = e.hash & bit;
                Node lastRun = e, lo = null, hi = null;
                for (Node p = e.next; p != null; p = p.next) {

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

            private static void splitBin(Node[] nextTab, int i, Node e) {
                int bit = nextTab.length >>> 1; // bit to split on
                int runBit = e.hash & bit;
                Node lastRun = e, lo = null, hi = null;
                for (Node p = e.next; p != null; p = p.next) {

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

                public final boolean containsAll(Collection<?> c) {
                    if (c != this) {
                        for (Iterator<?> it = c.iterator(); it.hasNext();) {
                            Object e = it.next();
                            if (e == null || !contains(e))

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

                final Object getValue(int h, Object k) {
                    Node r = null;
                    int c = getState(); // Must read lock state first
                    for (Node e = first; e != null; e = e.next) {
                        if (c <= 0 && compareAndSetState(c, c - 1)) {

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

                public final String toString() {
                    StringBuilder sb = new StringBuilder();
                    sb.append('[');
                    Iterator<?> it = iterator();
                    if (it.hasNext()) {

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

                public final boolean remove(Object o) {
                    if (o != null) {
                        Iterator<V> it = new ValueIterator<K,V>(map);
                        while (it.hasNext()) {
                            if (o.equals(it.next())) {

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

            public String toString() {
                Traverser<K,V,Object> it = new Traverser<K,V,Object>(this);
                StringBuilder sb = new StringBuilder();
                sb.append('{');
                Object v;

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

                private IRubyObject compareAndSetNumeric(ThreadContext context, IRubyObject expectedValue, IRubyObject newValue) {
                    Ruby runtime = context.runtime;
                    
                    // loop until:
                    // * reference CAS would succeed for same-valued objects
        Severity: Minor
        Found in ext/concurrent-ruby/com/concurrent_ruby/ext/AtomicReferenceLibrary.java - About 35 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 toString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public String toString() {
                Traverser<K,V,Object> it = new Traverser<K,V,Object>(this);
                StringBuilder sb = new StringBuilder();
                sb.append('{');
                Object v;

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

              private ConcurrentHashMap<IRubyObject, IRubyObject> toCHM(ThreadContext context, IRubyObject options) {
                Ruby runtime = context.getRuntime();
                if (!options.isNil() && options.respondsTo("[]")) {
                  IRubyObject rInitialCapacity = options.callMethod(context, "[]", runtime.newSymbol("initial_capacity"));
                  IRubyObject rLoadFactor      = options.callMethod(context, "[]", runtime.newSymbol("load_factor"));
        Severity: Minor
        Found in ext/concurrent-ruby/com/concurrent_ruby/ext/JRubyMapBackendLibrary.java - About 35 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 remove has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                public final boolean remove(Object o) {
                    if (o != null) {
                        Iterator<V> it = new ValueIterator<K,V>(map);
                        while (it.hasNext()) {
                            if (o.equals(it.next())) {

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

                public final boolean containsAll(Collection<?> c) {
                    if (c != this) {
                        for (Iterator<?> it = c.iterator(); it.hasNext();) {
                            Object e = it.next();
                            if (e == null || !contains(e))

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

                public final String toString() {
                    StringBuilder sb = new StringBuilder();
                    sb.append('[');
                    Iterator<?> it = iterator();
                    if (it.hasNext()) {

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

            def post(*args, &task)
              raise ArgumentError.new('no block given') unless block_given?
              deferred_action = synchronize {
                if running?
                  ns_execute(*args, &task)
        Severity: Minor
        Found in lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb - About 35 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 go_loop_via has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def go_loop_via(executor, *args, &block)
                raise ArgumentError.new('no block given') unless block_given?
                executor.post(block, *args) do
                  loop do
                    break unless block.call(*args)
        Severity: Minor
        Found in lib/concurrent-ruby-edge/concurrent/channel.rb - About 35 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 try_acquire has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def try_acquire(permits = 1, timeout = nil)
              Utility::NativeInteger.ensure_integer_and_bounds permits
              Utility::NativeInteger.ensure_positive permits
        
              acquired = synchronize do
        Severity: Minor
        Found in lib/concurrent-ruby/concurrent/atomic/mutex_semaphore.rb - About 35 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

        Severity
        Category
        Status
        Source
        Language