jdantonio/concurrent-ruby

View on GitHub
lib/concurrent-ruby-edge/concurrent/channel.rb

Summary

Maintainability
C
1 day
Test Coverage

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

        def validate(value, allow_nil, raise_error)
          if !allow_nil && value.nil?
            raise_error ? raise(ValidationError.new('nil is not a valid value')) : false
          elsif !validator.call(value)
            raise_error ? raise(ValidationError) : false
    Severity: Minor
    Found in lib/concurrent-ruby-edge/concurrent/channel.rb - About 2 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

    Method initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(opts = {})
          # undocumented -- for internal use only
          if opts.is_a? Buffer::Base
            self.buffer = opts
            return
    Severity: Minor
    Found in lib/concurrent-ruby-edge/concurrent/channel.rb - About 1 hr 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 go_loop_via has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def go_loop_via(executor, *args, &block)
            raise ArgumentError.new('no block given') unless block_given?
            executor.post(block, *args) do
              loop do
                break unless block.call(*args)
    Severity: Minor
    Found in lib/concurrent-ruby-edge/concurrent/channel.rb - About 35 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 each has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def each
          raise ArgumentError.new('no block given') unless block_given?
          loop do
            item, more = do_next
            if item != Concurrent::NULL
    Severity: Minor
    Found in lib/concurrent-ruby-edge/concurrent/channel.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

    There are no issues that match your filters.

    Category
    Status