jdantonio/concurrent-ruby

View on GitHub

Showing 303 of 498 total issues

Method release_read_lock has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def release_read_lock
      while true
        c = @Counter.value
        if @Counter.compare_and_set(c, c-1)
          # If one or more writers were waiting, and we were the last reader, wake a writer up
Severity: Minor
Found in lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb - About 45 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_wait_until has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def ns_wait_until(timeout = nil, &condition)
        if timeout
          wait_until = Concurrent.monotonic_time + timeout
          loop do
            now = Concurrent.monotonic_time

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

  def self.create_simple_logger(level = Logger::FATAL, output = $stderr)
    # TODO (pitr-ch 24-Dec-2016): figure out why it had to be replaced, stdlogger was deadlocking
    lambda do |severity, progname, message = nil, &block|
      return false if severity < level

Severity: Minor
Found in lib/concurrent-ruby/concurrent/concern/logging.rb - About 45 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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize(delayed, blockers_count, default_executor, executor, args, &task)
Severity: Minor
Found in lib/concurrent-ruby/concurrent/promises.rb - About 45 mins to fix

    Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def initialize(delayed, blockers_count, default_executor, executor, args, &task)
    Severity: Minor
    Found in lib/concurrent-ruby/concurrent/promises.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  elsif @Counter.compare_and_set(c, c+1)
                    @HeldCount.value = held + 1
                    return true
      Severity: Major
      Found in lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb - About 45 mins to fix

        Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def initialize(delayed, blockers_count, default_executor, executor, args, &task)
        Severity: Minor
        Found in lib/concurrent-ruby/concurrent/promises.rb - About 45 mins to fix

          Method compare_and_set has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def compare_and_set(expected_val, new_val, expected_mark, new_mark)
                # Memoize a valid reference to the current AtomicReference for
                # later comparison.
                current             = reference
                curr_val, curr_mark = current
          Severity: Minor
          Found in lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb - About 45 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 reason has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def reason(timeout = nil, timeout_value = nil, resolve_on_timeout = nil)
                  if wait_until_resolved timeout
                    internal_state.reason
                  else
                    if resolve_on_timeout
          Severity: Minor
          Found in lib/concurrent-ruby/concurrent/promises.rb - About 45 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 take has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def take
                    mine = synchronize do
                      return Concurrent::NULL if ns_closed? && putting.empty?
          
                      ref = Concurrent::AtomicReference.new(nil)
          Severity: Minor
          Found in lib/concurrent-ruby-edge/concurrent/channel/buffer/unbuffered.rb - About 45 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 consume_signal has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def consume_signal(message)
                  if AbstractSignal === message
                    case message
                    when Ask
                      @reply = message.probe
          Severity: Minor
          Found in lib/concurrent-ruby-edge/concurrent/edge/erlang_actor.rb - About 45 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 push has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def push(message, timeout = nil)
                  pushed_op = @Mutex.synchronize do
                    return timeout ? true : self if ns_try_push(message)
          
                    pushed = Promises.resolvable_future
          Severity: Minor
          Found in lib/concurrent-ruby-edge/concurrent/edge/channel.rb - About 45 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 value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def value(timeout = nil, timeout_value = nil, resolve_on_timeout = nil)
                  if wait_until_resolved timeout
                    internal_state.value
                  else
                    if resolve_on_timeout
          Severity: Minor
          Found in lib/concurrent-ruby/concurrent/promises.rb - About 45 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_shift_message has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def ns_shift_message(matcher, remove = true)
                  i = 0
                  while true
                    message = @Messages.fetch(i, NOTHING)
                    return NOTHING if message == NOTHING
          Severity: Minor
          Found in lib/concurrent-ruby-edge/concurrent/edge/channel.rb - About 45 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

          Avoid deeply nested control flow statements.
          Open

                      break if !running_writer?(c) && !running_readers?(c) && @Counter.compare_and_set(c, c+RUNNING_WRITER-WAITING_WRITER)
          Severity: Major
          Found in lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb - About 45 mins to fix

            Method on_envelope has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def on_envelope(envelope)
                      command, reason = envelope.message
                      case command
                      when :terminated?
                        terminated?
            Severity: Minor
            Found in lib/concurrent-ruby-edge/concurrent/actor/behaviour/termination.rb - About 45 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 InstanceVariableSetVolatile has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                            ThreadContext context,
                            IRubyObject module,
                            IRubyObject self,
                            IRubyObject name,
                            IRubyObject value) {
            Severity: Minor
            Found in ext/concurrent-ruby/com/concurrent_ruby/ext/SynchronizationLibrary.java - About 35 mins to fix

              Method resolve has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                    def resolve(fulfilled = true, value = nil, reason = nil, raise_on_reassign = true, reserved = false)
              Severity: Minor
              Found in lib/concurrent-ruby/concurrent/promises.rb - About 35 mins to fix

                Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        def initialize(core, subsequent, core_options, trapping = false, terminate_children = true)
                Severity: Minor
                Found in lib/concurrent-ruby-edge/concurrent/actor/behaviour/termination.rb - About 35 mins to fix

                  Method create has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def self.create(type, channel, environment, name, executor)
                  Severity: Minor
                  Found in lib/concurrent-ruby-edge/concurrent/edge/erlang_actor.rb - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language