jdantonio/concurrent-ruby

View on GitHub

Showing 303 of 498 total issues

Avoid too many return statements within this method.
Open

        return null;

    Avoid too many return statements within this method.
    Open

            return null;

      Avoid too many return statements within this method.
      Open

              return val;

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

            def self.zip(*promises)
              opts = promises.last.is_a?(::Hash) ? promises.pop.dup : {}
              opts[:executor] ||= ImmediateExecutor.new
              zero = if !opts.key?(:execute) || opts.delete(:execute)
                fulfill([], opts)
        Severity: Minor
        Found in lib/concurrent-ruby/concurrent/promise.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 reconfigure has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def reconfigure(&block)
              synchronize do
                raise ArgumentError.new('no block given') unless block_given?
                unless @evaluation_started
                  @task = block
        Severity: Minor
        Found in lib/concurrent-ruby/concurrent/delay.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 if_state has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def if_state(*expected_states)
                synchronize do
                  raise ArgumentError.new('no block given') unless block_given?
        
                  if expected_states.include? @state
        Severity: Minor
        Found in lib/concurrent-ruby/concurrent/concern/obligation.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