jdantonio/concurrent-ruby

View on GitHub

Showing 303 of 498 total issues

Avoid too many return statements within this method.
Open

        return val;

    Avoid too many return statements within this method.
    Open

            return null;

      Avoid too many return statements within this method.
      Open

              return null;

        Method supportsFences has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private static boolean supportsFences() {
                if (UNSAFE == null) {
                    return false;
                } else {
                    try {
        Severity: Minor
        Found in ext/concurrent-ruby/com/concurrent_ruby/ext/SynchronizationLibrary.java - About 25 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 internalReset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            final void internalReset(long initialValue) {
                Cell[] as = cells;
                base = initialValue;
                if (as != null) {
                    int n = as.length;
        Severity: Minor
        Found in ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/Striped64.java - About 25 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 addAll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                public boolean addAll(Collection<? extends K> c) {
                    boolean added = false;
                    V v;
                    if ((v = value) == null)
                        throw new UnsupportedOperationException();

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

            public long sumThenReset() {
                long sum = base;
                Cell[] as = cells;
                base = 0L;
                if (as != null) {
        Severity: Minor
        Found in ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/LongAdder.java - About 25 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 nextLong has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public long nextLong(long n) {
                if (n <= 0)
                    throw new IllegalArgumentException("n must be positive");
                // Divide n by two until small enough for nextInt. On each
                // iteration (at most 31 of them but usually much less),

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

            public long sum() {
                long sum = base;
                Cell[] as = cells;
                if (as != null) {
                    int n = as.length;

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

                private void rotateRight(TreeNode p) {
                    if (p != null) {
                        TreeNode l = p.left, pp, lr;
                        if ((lr = p.left = l.right) != null)
                            lr.parent = p;

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

            final void internalReset(long initialValue) {
                Cell[] as = cells;
                base = initialValue;
                if (as != null) {
                    int n = as.length;

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

                private void rotateLeft(TreeNode p) {
                    if (p != null) {
                        TreeNode r = p.right, pp, rl;
                        if ((rl = p.right = r.left) != null)
                            rl.parent = p;

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

            public long sumThenReset() {
                long sum = base;
                Cell[] as = cells;
                base = 0L;
                if (as != null) {

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

                private void rotateLeft(TreeNode p) {
                    if (p != null) {
                        TreeNode r = p.right, pp, rl;
                        if ((rl = p.right = r.left) != null)
                            rl.parent = p;

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

            public long sum() {
                long sum = base;
                Cell[] as = cells;
                if (as != null) {
                    int n = as.length;
        Severity: Minor
        Found in ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/LongAdder.java - About 25 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 rotateRight has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                private void rotateRight(TreeNode p) {
                    if (p != null) {
                        TreeNode l = p.left, pp, lr;
                        if ((lr = p.left = l.right) != null)
                            lr.parent = p;

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

                public boolean addAll(Collection<? extends K> c) {
                    boolean added = false;
                    V v;
                    if ((v = value) == null)
                        throw new UnsupportedOperationException();

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

              def initial_signal_consumption
                while true
                  message = @Mailbox.try_pop
                  break unless message
                  consume_signal(message) == NOTHING or raise 'it was not consumable signal'
        Severity: Minor
        Found in lib/concurrent-ruby-edge/concurrent/edge/erlang_actor.rb - About 25 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_ready_worker has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def ns_ready_worker(worker, last_message, success = true)
              task_and_args = @queue.shift
              if task_and_args
                worker << task_and_args
              else
        Severity: Minor
        Found in lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb - About 25 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 <=> has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def <=>(other)
              if nothing?
                other.nothing? ? 0 : -1
              else
                other.nothing? ? 1 : just <=> other.just
        Severity: Minor
        Found in lib/concurrent-ruby/concurrent/maybe.rb - About 25 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