jdantonio/concurrent-ruby

View on GitHub

Showing 303 of 498 total issues

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

        def self.create(type, channel, environment, name, executor)
    Severity: Minor
    Found in lib/concurrent-ruby-edge/concurrent/edge/erlang_actor.rb - About 35 mins to fix

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

            def resolve(fulfilled = true, value = nil, reason = nil, raise_on_reassign = true, reserved = false)
      Severity: Minor
      Found in lib/concurrent-ruby/concurrent/promises.rb - About 35 mins to fix

        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 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 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 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 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 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 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 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 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 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 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 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 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

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

          def call_dataflow(method, executor, *inputs, &block)
            raise ArgumentError.new('an executor must be provided') if executor.nil?
            raise ArgumentError.new('no block given') unless block_given?
            unless inputs.all? { |input| input.is_a? IVar }
              raise ArgumentError.new("Not all dependencies are IVars.\nDependencies: #{ inputs.inspect }")
        Severity: Minor
        Found in lib/concurrent-ruby/concurrent/dataflow.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 terminate! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def terminate!(reason = nil, envelope = nil)
                  return true if terminated?
        
                  self_termination = Concurrent::Promises.resolved_future(reason.nil?, reason.nil? || nil, reason)
                  all_terminations = if @terminate_children
        Severity: Minor
        Found in lib/concurrent-ruby-edge/concurrent/actor/behaviour/termination.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