jdantonio/concurrent-ruby

View on GitHub

Showing 303 of 498 total issues

Method internalPut has a Cognitive Complexity of 71 (exceeds 5 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;

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 internalPut has a Cognitive Complexity of 71 (exceeds 5 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;

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

    private static final AtomicReferenceArray<Node> rebuild(AtomicReferenceArray<Node> tab) {
        int n = tab.length();
        AtomicReferenceArray<Node> nextTab = new AtomicReferenceArray<Node>(n << 1);
        Node fwd = new Node(MOVED, nextTab, null, null);
        int[] buffer = null;       // holds bins to revisit; null until needed

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

    private static final Node[] rebuild(Node[] tab) {
        int n = tab.length;
        Node[] nextTab = new Node[n << 1];
        Node fwd = new Node(MOVED, nextTab, null, null);
        int[] buffer = null;       // holds bins to revisit; null until needed

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

ConcurrentHashMapV8 has 60 methods (exceeds 20 allowed). Consider refactoring.
Open

public class ConcurrentHashMapV8<K, V>
        implements ConcurrentMap<K, V>, Serializable, ConcurrentHashMap<K, V> {
    private static final long serialVersionUID = 7249069246763182397L;

    /**

    Method retryUpdate has a Cognitive Complexity of 55 (exceeds 5 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: Minor
    Found in ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/Striped64.java - About 1 day 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 retryUpdate has a Cognitive Complexity of 55 (exceeds 5 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;

    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

    ConcurrentHashMapV8 has 58 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class ConcurrentHashMapV8<K, V>
            implements ConcurrentMap<K, V>, Serializable, ConcurrentHashMap<K, V> {
        private static final long serialVersionUID = 7249069246763182397L;
    
        /**

      Method readObject has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
      Open

          @SuppressWarnings("unchecked") private void readObject(java.io.ObjectInputStream s)
                  throws java.io.IOException, ClassNotFoundException {
              s.defaultReadObject();
              this.segments = null; // unneeded
              // initialize transient final field

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

          @SuppressWarnings("unchecked") private void readObject(java.io.ObjectInputStream s)
                  throws java.io.IOException, ClassNotFoundException {
              s.defaultReadObject();
              this.segments = null; // unneeded
              // initialize transient final field

      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 deleteTreeNode has 159 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              final void deleteTreeNode(TreeNode p) {
                  TreeNode next = (TreeNode)p.next; // unlink traversal pointers
                  TreeNode pred = p.prev;
                  if (pred == null)
                      first = next;

        Method deleteTreeNode has 159 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                final void deleteTreeNode(TreeNode p) {
                    TreeNode next = (TreeNode)p.next; // unlink traversal pointers
                    TreeNode pred = p.prev;
                    if (pred == null)
                        first = next;

          Method internalClear has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
          Open

              private final void internalClear() {
                  long delta = 0L; // negative number of deletions
                  int i = 0;
                  AtomicReferenceArray<Node> tab = table;
                  while (tab != null && i < tab.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 internalClear has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
          Open

              private final void internalClear() {
                  long delta = 0L; // negative number of deletions
                  int i = 0;
                  Node[] tab = table;
                  while (tab != null && i < tab.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 advance has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
          Open

                  final V advance() {
                      Node e = next;
                      V ev = null;
                      outer: do {
                          if (e != null)                  // advance past used/skipped node

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

                  final V advance() {
                      Node e = next;
                      V ev = null;
                      outer: do {
                          if (e != null)                  // advance past used/skipped node

          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 internalCompute has 126 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @SuppressWarnings("unchecked") private final Object internalCompute
              (K k, boolean onlyIfPresent, BiFun<? super K, ? super V, ? extends V> mf) {
                  int h = spread(k.hashCode());
                  Object val = null;
                  int delta = 0;

            Method internalCompute has 126 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @SuppressWarnings("unchecked") private final Object internalCompute
                (K k, boolean onlyIfPresent, BiFun<? super K, ? super V, ? extends V> mf) {
                    int h = spread(k.hashCode());
                    Object val = null;
                    int delta = 0;

              Class Future has 38 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Future < AbstractEventFuture
              
                    # Is it in fulfilled state?
                    # @return [Boolean]
                    def fulfilled?
              Severity: Minor
              Found in lib/concurrent-ruby/concurrent/promises.rb - About 5 hrs to fix

                Method internalComputeIfAbsent has 123 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private final Object internalComputeIfAbsent(K k,
                                                                 Fun<? super K, ?> mf) {
                        int h = spread(k.hashCode());
                        Object val = null;
                        int count = 0;
                  Severity
                  Category
                  Status
                  Source
                  Language