ReactiveX/RxRuby

View on GitHub

Showing 104 of 124 total issues

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

    def _subscribe(observer)

      auto_detach_observer = AutoDetachObserver.new observer

      if CurrentThreadScheduler.schedule_required?
Severity: Minor
Found in lib/rx/core/observable.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 generate has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def generate(initial_state, condition, iterate, result_selector, scheduler = CurrentThreadScheduler.instance)
Severity: Minor
Found in lib/rx/operators/creation.rb - About 35 mins to fix

    Method concat_map has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def concat_map(selector, result_selector = nil)
          if Proc === result_selector
            return concat_map(lambda {|x, i|
              selector_result = selector.call(x, i)
              if selector_result.respond_to?(:each)
    Severity: Minor
    Found in lib/rx/linq/observable/concat_map.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 subscribe has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def subscribe(observer)
          raise 'observer cannot be nil' unless observer
    
          err = nil
          gate.synchronize do
    Severity: Minor
    Found in lib/rx/subjects/behavior_subject.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 to_async has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_async(func, context = nil, scheduler = DefaultScheduler.instance)
          lambda() {|*args|
            subject = AsyncSubject.new
    
            scheduler.schedule lambda {
    Severity: Minor
    Found in lib/rx/linq/observable/to_async.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 schedule_relative_with_state has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def schedule_relative_with_state(state, due_time, action)
          raise 'action cannot be nil' unless action
    
          dt = Scheduler.normalize due_time
          return self.schedule_with_state state, action if dt == 0
    Severity: Minor
    Found in lib/rx/concurrency/default_scheduler.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 ref_count has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def ref_count
          count = 0
          AnonymousObservable.new do |observer|
            count += 1
            should_connect = true if count == 1
    Severity: Minor
    Found in lib/rx/linq/connectable_observable.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 subscribe has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def subscribe(observer)
          raise 'observer cannot be nil' unless observer
    
          err = nil
          v = nil
    Severity: Minor
    Found in lib/rx/subjects/async_subject.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 release has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def release
          subscription = nil
          @gate.synchronize do
            if @subscription
              @count -= 1
    Severity: Minor
    Found in lib/rx/subscriptions/ref_count_subscription.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 subscription= has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def subscription=(new_subscription)
          raise 'Subscription already set' if @set
    
          @set = true
          should_unsubscribe = false
    Severity: Minor
    Found in lib/rx/subscriptions/single_assignment_subscription.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 timer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def timer(due_time, period_or_scheduler = DefaultScheduler.instance, scheduler = DefaultScheduler.instance)
          case period_or_scheduler
          when Numeric
            period = period_or_scheduler
          when Scheduler
    Severity: Minor
    Found in lib/rx/linq/observable/timer.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 schedule_relative_with_state has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def schedule_relative_with_state(state, due_time, action) 
            return self.schedule_with_state state, action if due_time <= 0
    
            m = SingleAssignmentSubscription.new
    
    
    Severity: Minor
    Found in lib/rx/concurrency/immediate_scheduler.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 on_completed has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_completed
          os = nil
          v = nil
          hv = false
    
    
    Severity: Minor
    Found in lib/rx/subjects/async_subject.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 contains has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def contains(search_element, from_index = 0)
          AnonymousObservable.new do |observer|
            i = 0
            n = from_index
            if n < 0
    Severity: Minor
    Found in lib/rx/linq/observable/contains.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 subscription= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def subscription=(new_subscription)
          should_unsubscribe = false
          old = nil
          @gate.synchronize do
            should_unsubscribe = @unsubscribed
    Severity: Minor
    Found in lib/rx/subscriptions/serial_subscription.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def create(on_next = nil, on_error = nil, on_completed = nil)
            configure do |o|
              o.on_next(&on_next) if on_next
              o.on_error(&on_error) if on_error
              o.on_completed(&on_completed) if on_completed
    Severity: Minor
    Found in lib/rx/core/observer.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 on_error has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_error(error)
          raise 'error cannot be nil' unless error
    
          os = nil
          gate.synchronize do
    Severity: Minor
    Found in lib/rx/subjects/async_subject.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 subscribe has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def subscribe(observer)
          raise 'observer cannot be nil' unless observer
    
          @gate.synchronize do
            check_disposed
    Severity: Minor
    Found in lib/rx/subjects/subject.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 last has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def last(&block)
          return select(&block).last if block_given?
          AnonymousObservable.new do |observer|
    
            value = nil
    Severity: Minor
    Found in lib/rx/operators/aggregates.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 last_or_default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def last_or_default(default_value = nil, &block)
          return select(&block).last_or_default(default_value) if block_given?
          AnonymousObservable.new do |observer|
    
            value = nil
    Severity: Minor
    Found in lib/rx/operators/aggregates.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