jdantonio/concurrent-ruby

View on GitHub

Showing 498 of 498 total issues

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;

          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;

            Method getTreeNode has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
            Open

                    @SuppressWarnings("unchecked") final TreeNode getTreeNode
                    (int h, RubyObject k, TreeNode p) {
                        RubyClass c = k.getMetaClass(); boolean kNotComparable = !k.respondsTo("<=>");
                        while (p != null) {
                            int dir, ph;  RubyObject pk; RubyClass pc;

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

                    @SuppressWarnings("unchecked") final TreeNode getTreeNode
                    (int h, RubyObject k, TreeNode p) {
                        RubyClass c = k.getMetaClass(); boolean kNotComparable = !k.respondsTo("<=>");
                        while (p != null) {
                            int dir, ph;  RubyObject pk; RubyClass pc;

            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

            Class Channel has 36 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class Channel < Concurrent::Synchronization::Object
            
                  # TODO (pitr-ch 06-Jan-2019): rename to Conduit?, to be able to place it into Concurrent namespace?
                  # TODO (pitr-ch 14-Jan-2019): better documentation, do few examples from go
                  # TODO (pitr-ch 12-Dec-2018): implement channel closing,
            Severity: Minor
            Found in lib/concurrent-ruby-edge/concurrent/edge/channel.rb - About 4 hrs to fix

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  public static class KeySetView<K,V> extends CHMView<K,V> implements Set<K>, java.io.Serializable {
                      private static final long serialVersionUID = 7249069246763182397L;
                      private final V value;
                      KeySetView(ConcurrentHashMapV8<K, V> map, V value) {  // non-public
                          super(map);
              ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/ConcurrentHashMapV8.java on lines 3629..3689

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 269.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  public static class KeySetView<K,V> extends CHMView<K,V> implements Set<K>, java.io.Serializable {
                      private static final long serialVersionUID = 7249069246763182397L;
                      private final V value;
                      KeySetView(ConcurrentHashMapV8<K, V> map, V value) {  // non-public
                          super(map);
              ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/ConcurrentHashMapV8.java on lines 3637..3697

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 269.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Method ns_pop_op has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
              Open

                    def ns_pop_op(matcher, probe, include_channel)
                      message = ns_shift_message matcher
              
                      # got message from buffer
                      if message != NOTHING
              Severity: Minor
              Found in lib/concurrent-ruby-edge/concurrent/edge/channel.rb - About 4 hrs 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

              Class Channel has 33 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class Channel
                  extend Forwardable
                  include Enumerable
              
                  # NOTE: Move to global IO pool once stable
              Severity: Minor
              Found in lib/concurrent-ruby-edge/concurrent/channel.rb - About 4 hrs to fix

                Method internalMerge has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Method internalMerge has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Method single_test has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def single_test(lock, n_readers, n_writers, reader_iterations=50, writer_iterations=50, reader_sleep=0.001, writer_sleep=0.001)
                      puts "Testing #{lock.class} with #{n_readers} readers and #{n_writers} writers. Readers iterate #{reader_iterations} times, sleeping #{reader_sleep}s each time, writers iterate #{writer_iterations} times, sleeping #{writer_sleep}s each time"
                      mutex = Mutex.new
                      bad   = false
                      data  = 0
                    Severity: Minor
                    Found in examples/benchmark_read_write_lock.rb - About 4 hrs 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

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                                        try {
                                            if (tabAt(tab, i) == f) {
                                                count = 1;
                                                for (Node e = f;; ++count) {
                                                    Object ek, ev;
                    ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/ConcurrentHashMapV8.java on lines 1652..1680

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 254.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                                        try {
                                            if (tabAt(tab, i) == f) {
                                                count = 1;
                                                for (Node e = f;; ++count) {
                                                    Object ek, ev;
                    ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/ConcurrentHashMapV8.java on lines 1644..1672

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 254.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Class AbstractEventFuture has 32 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        class AbstractEventFuture < Synchronization::Object
                          safe_initialization!
                          attr_atomic(:internal_state)
                          private :internal_state=, :swap_internal_state, :compare_and_set_internal_state, :update_internal_state
                          # @!method internal_state
                    Severity: Minor
                    Found in lib/concurrent-ruby/concurrent/promises.rb - About 4 hrs to fix

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                                  else if ((fh = f.hash) == MOVED) {
                                      if ((fk = f.key) instanceof TreeBin) {
                                          TreeBin t = (TreeBin)fk;
                                          t.acquire(0);
                                          try {
                      ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/ConcurrentHashMapV8.java on lines 1725..1762

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 250.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                                  else if ((fh = f.hash) == MOVED) {
                                      if ((fk = f.key) instanceof TreeBin) {
                                          TreeBin t = (TreeBin)fk;
                                          t.acquire(0);
                                          try {
                      ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/ConcurrentHashMapV8.java on lines 1733..1770

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 250.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Severity
                      Category
                      Status
                      Source
                      Language