ruby-concurrency/thread_safe

View on GitHub

Showing 181 of 329 total issues

Avoid too many return statements within this method.
Open

        return null;
Severity: Major
Found in ext/org/jruby/ext/thread_safe/jsr166e/ConcurrentHashMapV8.java - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return val;
    Severity: Major
    Found in ext/org/jruby/ext/thread_safe/jsr166e/ConcurrentHashMapV8.java - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return val;
      Severity: Major
      Found in ext/org/jruby/ext/thread_safe/jsr166e/nounsafe/ConcurrentHashMapV8.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return null;
        Severity: Major
        Found in ext/org/jruby/ext/thread_safe/jsr166e/nounsafe/ConcurrentHashMapV8.java - About 30 mins to fix

          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/org/jruby/ext/thread_safe/jsr166e/nounsafe/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;
          Severity: Minor
          Found in ext/org/jruby/ext/thread_safe/jsr166e/ConcurrentHashMapV8.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;
          Severity: Minor
          Found in ext/org/jruby/ext/thread_safe/jsr166e/nounsafe/ConcurrentHashMapV8.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/org/jruby/ext/thread_safe/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 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/org/jruby/ext/thread_safe/jsr166e/nounsafe/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 add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def add(x)
                  if (current_cells = cells) || !cas_base_computed {|current_base| current_base + x}
                    was_uncontended = true
                    hash            = hash_code
                    unless current_cells && (cell = current_cells.volatile_get_by_hash(hash)) && (was_uncontended = cell.cas_computed {|current_value| current_value + x})
          Severity: Minor
          Found in lib/thread_safe/util/adder.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 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/org/jruby/ext/thread_safe/jsr166e/nounsafe/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 validate_options_hash! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def validate_options_hash!(options)
                if (initial_capacity = options[:initial_capacity]) && (!initial_capacity.kind_of?(0.class) || initial_capacity < 0)
                  raise ArgumentError, ":initial_capacity must be a positive #{0.class}"
                end
                if (load_factor = options[:load_factor]) && (!load_factor.kind_of?(Numeric) || load_factor <= 0 || load_factor > 1)
          Severity: Minor
          Found in lib/thread_safe/cache.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 try_initialize_cells has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def try_initialize_cells(x, hash)
                  if free? && !cells
                    try_in_busy do
                      unless cells # Recheck under lock
                        new_cells = PowerOfTwoTuple.new(2)
          Severity: Minor
          Found in lib/thread_safe/util/striped64.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 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/org/jruby/ext/thread_safe/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;
          Severity: Minor
          Found in ext/org/jruby/ext/thread_safe/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),
          Severity: Minor
          Found in ext/org/jruby/ext/thread_safe/jsr166y/ThreadLocalRandom.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 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;
          Severity: Minor
          Found in ext/org/jruby/ext/thread_safe/jsr166e/nounsafe/ConcurrentHashMapV8.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 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;
          Severity: Minor
          Found in ext/org/jruby/ext/thread_safe/jsr166e/ConcurrentHashMapV8.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();
          Severity: Minor
          Found in ext/org/jruby/ext/thread_safe/jsr166e/ConcurrentHashMapV8.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 cheap_wait has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  def cheap_wait
                    wchan = Rubinius::Channel.new
          
                    begin
                      waiters = @waiters ||= []
          Severity: Minor
          Found in lib/thread_safe/util/cheap_lockable.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