ReactiveX/RxRuby

View on GitHub

Showing 104 of 124 total issues

Method while has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def while(condition, source)
      enum = Enumerator.new {|y|
        while condition.call
          y << source
        end
Severity: Minor
Found in lib/rx/linq/observable/while.rb - About 1 hr to fix

    Method invoke_recursive has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def invoke_recursive(scheduler, pair)
          group = CompositeSubscription.new
          gate = Mutex.new
          state = pair[:state]
          action = pair[:action]
    Severity: Minor
    Found in lib/rx/concurrency/scheduler.rb - About 1 hr to fix

      Method when has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def when(*plans)
            AnonymousObservable.new do |observer|
              active_plans = []
              external_subscriptions = {}
              out_observer = Observer.configure {|o|
      Severity: Minor
      Found in lib/rx/linq/observable/when.rb - About 1 hr to fix

        Method generate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def generate(initial_state, condition, iterate, result_selector, scheduler = CurrentThreadScheduler.instance)
                AnonymousObservable.new do |observer|
                  state = initial_state
                  first = true
                  
        Severity: Minor
        Found in lib/rx/operators/creation.rb - About 1 hr to fix

          Method skip_until has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def skip_until(other)
                raise ArgumentError.new 'Other cannot be nil' unless other
          
                AnonymousObservable.new do |observer|
                  source_subscription = SingleAssignmentSubscription.new
          Severity: Minor
          Found in lib/rx/operators/multiple.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 from has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def from(iterable, map_fn = nil, scheduler = CurrentThreadScheduler.instance)
                it = iterable.to_enum
                AnonymousObservable.new {|observer|
                  i = 0
                  scheduler.schedule_recursive lambda {|this|
          Severity: Minor
          Found in lib/rx/linq/observable/from.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 match has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def match
                has_values = true
                @join_observer_array.each {|v|
                  if v.queue.length == 0
                    has_values = false
          Severity: Minor
          Found in lib/rx/joins/active_plan.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 take has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def take(count, scheduler = ImmediateScheduler.instance)
                return Observable.empty(scheduler) if count == 0
          
                AnonymousObservable.new do |observer|
          
          
          Severity: Minor
          Found in lib/rx/operators/standard_query_operators.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 configure has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def configure(options = {})
                options.each {|key,_|
                  unless [:created, :subscribed, :disposed].include? key
                    raise ArgumentError, "Should be specified whether :created, :subscribed or :disposed, but the #{key.inspect}"
                  end
          Severity: Minor
          Found in lib/rx/testing/test_scheduler.rb - About 1 hr to fix

            Method merge_all has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def merge_all
                  AnonymousObservable.new do |observer|
                    gate = Monitor.new
                    stopped = false
                    m = SingleAssignmentSubscription.new
            Severity: Minor
            Found in lib/rx/operators/multiple.rb - About 1 hr to fix

              Method from has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def from(iterable, map_fn = nil, scheduler = CurrentThreadScheduler.instance)
                    it = iterable.to_enum
                    AnonymousObservable.new {|observer|
                      i = 0
                      scheduler.schedule_recursive lambda {|this|
              Severity: Minor
              Found in lib/rx/linq/observable/from.rb - About 1 hr to fix

                Method concat_map_observer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def concat_map_observer(on_next, on_error, on_completed)
                      AnonymousObservable.new do |observer|
                        index = 0
                
                        subscribe(
                Severity: Minor
                Found in lib/rx/linq/observable/concat_map_observer.rb - About 55 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 reduce has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def reduce(*args, &block)
                      # Argument parsing to support:
                      # 1. (seed, Symbol) || (seed, &block)
                      # 2. (Symbol) || (&block)
                      if (args.length == 2 && args[1].is_a?(Symbol)) || (args.length == 1 && block_given?)
                Severity: Minor
                Found in lib/rx/operators/aggregates.rb - About 55 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 rescue_error has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def rescue_error(other = nil, &action)
                      return Observable.rescue_error(other) if other && !block_given?
                      raise ArgumentError.new 'Invalid arguments' if other.nil? && !block_given?
                
                      AnonymousObservable.new do |observer|
                Severity: Minor
                Found in lib/rx/operators/multiple.rb - About 55 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 select_with_index has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def select_with_index(&block)
                      AnonymousObservable.new do |observer|
                        i = 0
                
                        new_observer = Observer.configure do |o|
                Severity: Minor
                Found in lib/rx/operators/standard_query_operators.rb - About 55 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 while has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def while(condition, source)
                      enum = Enumerator.new {|y|
                        while condition.call
                          y << source
                        end
                Severity: Minor
                Found in lib/rx/linq/observable/while.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 zip has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                      def zip(*args, &result_selector)
                        AnonymousObservable.new do |observer|
                          result_selector ||= lambda {|*inner_args| inner_args }
                          n = args.length
                
                
                Severity: Minor
                Found in lib/rx/operators/multiple.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 _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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def initialize(source, on_error)
                      super Observer.configure {|o|
                        o.on_next {|notification|
                          if !@is_disposed
                            if notification.on_error?
                Severity: Minor
                Found in lib/rx/joins/join_observer.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 start has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def start
                      unless @enabled
                        @enabled = true
                
                        begin
                Severity: Minor
                Found in lib/rx/concurrency/virtual_time_scheduler.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

                Severity
                Category
                Status
                Source
                Language