ReactiveX/RxRuby

View on GitHub

Showing 104 of 124 total issues

Method combine_latest has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def combine_latest(other, &result_selector)
      AnonymousObservable.new do |observer|
        has_left = false
        has_right = false

Severity: Major
Found in lib/rx/operators/multiple.rb - About 2 hrs to fix

    Method delay_time_span has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def delay_time_span(due_time, scheduler)
          AnonymousObservable.new do |observer|
            active = false
            cancelable = SerialSubscription.new
            exception = nil
    Severity: Major
    Found in lib/rx/linq/observable/delay.rb - About 2 hrs to fix

      Method delay_with_selector has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def delay_with_selector(subscription_delay, delay_duration_selector = nil)
            if Proc === subscription_delay
              selector = subscription_delay
            else
              sub_delay = subscription_delay
      Severity: Major
      Found in lib/rx/linq/observable/delay_with_selector.rb - About 2 hrs to fix

        Method skip_while_with_index has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def skip_while_with_index(&block)
              AnonymousObservable.new do |observer|
                running = false
                i = 0
        
        
        Severity: Minor
        Found in lib/rx/operators/standard_query_operators.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 take_while_with_index has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def take_while_with_index(&block)
              AnonymousObservable.new do |observer|
                running = true
                i = 0
        
        
        Severity: Minor
        Found in lib/rx/operators/standard_query_operators.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 rescue_error has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def rescue_error(*args)
                AnonymousObservable.new do |observer|
                  gate = AsyncLock.new
                  disposed = false
                  e = args.length == 1 && args[0].is_a?(Enumerator) ? args[0] : args.to_enum
        Severity: Minor
        Found in lib/rx/operators/multiple.rb - About 1 hr to fix

          Method fork_join has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def fork_join(*all_sources)
                AnonymousObservable.new {|subscriber|
                  count = all_sources.length
                  if count == 0
                    subscriber.on_completed
          Severity: Minor
          Found in lib/rx/linq/observable/fork_join.rb - About 1 hr to fix

            Method distinct has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def distinct(&key_selector)
                  key_selector ||= lambda {|x| x}
            
                  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 generate has a Cognitive Complexity of 15 (exceeds 5 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

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

                  def combine_latest(*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 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 merge_concurrent has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def merge_concurrent(max_concurrent = 1)
                  AnonymousObservable.new do |observer|
                    gate = Monitor.new
                    q = []
                    stopped = false
            Severity: Minor
            Found in lib/rx/operators/multiple.rb - About 1 hr to fix

              Method scan has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def scan(*args, &block)
                    has_seed = false
                    seed = nil
                    action = nil
              
              
              Severity: Minor
              Found in lib/rx/operators/single.rb - About 1 hr to fix

                Method tap has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    def tap(observer)
                      raise ArgumentError.new 'Observer cannot be nil' unless observer
                      AnonymousObservable.new do |obs|
                        new_obs = Rx::Observer.configure do |o|
                
                
                Severity: Minor
                Found in lib/rx/operators/single.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 do has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    def do(observer_or_on_next = nil, on_error_func = nil, on_completed_func = nil)
                      if block_given?
                        on_next_func = Proc.new
                      elsif Proc === observer_or_on_next
                        on_next_func = observer_or_on_next
                Severity: Minor
                Found in lib/rx/linq/observable/do.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 combine_latest has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def combine_latest(*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 1 hr to fix

                  Method on_error_resume_next has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def on_error_resume_next(*args)
                          AnonymousObservable.new do |observer|
                            gate = AsyncLock.new
                            disposed = false
                            e = args.length == 1 && args[0].is_a?(Enumerator) ? args[0] : args.to_enum
                  Severity: Minor
                  Found in lib/rx/operators/multiple.rb - About 1 hr to fix

                    Method concat has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def concat(*args)
                            AnonymousObservable.new do |observer|
                              disposed = false
                              e = args.length == 1 && args[0].is_a?(Enumerator) ? args[0] : args.to_enum
                              subscription = SerialSubscription.new
                    Severity: Minor
                    Found in lib/rx/operators/multiple.rb - About 1 hr to fix

                      Method sample has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def sample(intervalOrSampler, scheduler = DefaultScheduler.instance, &recipe)
                            sampler = if intervalOrSampler.is_a? Numeric
                              Observable.interval(intervalOrSampler, scheduler)
                            else
                              intervalOrSampler
                      Severity: Minor
                      Found in lib/rx/linq/observable/sample.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 delay_with_selector has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def delay_with_selector(subscription_delay, delay_duration_selector = nil)
                            if Proc === subscription_delay
                              selector = subscription_delay
                            else
                              sub_delay = subscription_delay
                      Severity: Minor
                      Found in lib/rx/linq/observable/delay_with_selector.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 wait has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def wait(&action)
                            @gate.synchronize do
                              @queue.push action unless @has_faulted
                      
                              if @is_acquired or @has_faulted
                      Severity: Minor
                      Found in lib/rx/concurrency/async_lock.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

                      Severity
                      Category
                      Status
                      Source
                      Language