ReactiveX/RxJava

View on GitHub

Showing 1,068 of 1,068 total issues

Method getPluginImplementationViaProperty has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    /* test */ static Object getPluginImplementationViaProperty(Class<?> pluginClass, Properties propsIn) {
        // Make a defensive clone because traversal may fail with ConcurrentModificationException
        // if the properties get changed by something outside RxJava.
        Properties props = (Properties)propsIn.clone();

Severity: Minor
Found in src/main/java/rx/plugins/RxJavaPlugins.java - About 3 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 call has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void call(final Subscriber<? super T> child) {

        // when true is a marker to say we are ready to resubscribe to source
        final AtomicBoolean resumeBoundary = new AtomicBoolean(true);
Severity: Minor
Found in src/main/java/rx/internal/operators/OnSubscribeRedo.java - About 3 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 drain has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    private void drain() {
        if (wip.getAndIncrement() == 0) {
            final Subscriber<? super T> c = child;
            final Queue<Object> q = queue;
            do {
Severity: Minor
Found in src/main/java/rx/internal/producers/QueuedValueProducer.java - About 3 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 drain has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    private void drain() {
        if (wip.getAndIncrement() == 0) {
            final Subscriber<? super T> c = child;
            final Queue<Object> q = queue;

Severity: Minor
Found in src/main/java/rx/internal/producers/QueuedProducer.java - About 3 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 emitLoop has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    void emitLoop() {
        final Subscriber<? super T> c = child;

        long toRequest = 0L;
        Producer requestFrom = null;
Severity: Major
Found in src/main/java/rx/internal/producers/ProducerObserverArbiter.java - About 3 hrs to fix

    File OnSubscribeCombineLatest.java has 328 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * Copyright 2015 Netflix, Inc.
     *
     * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
     * compliance with the License. You may obtain a copy of the License at
    Severity: Minor
    Found in src/main/java/rx/internal/operators/OnSubscribeCombineLatest.java - About 3 hrs to fix

      Method amb has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static Completable amb(final Iterable<? extends Completable> sources) {
              requireNonNull(sources);
      
              return create(new OnSubscribe() {
                  @Override
      Severity: Major
      Found in src/main/java/rx/Completable.java - About 3 hrs to fix

        OnSubscribeRedo has 31 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public final class OnSubscribeRedo<T> implements OnSubscribe<T> {
            final Observable<T> source;
            private final Func1<? super Observable<? extends Notification<?>>, ? extends Observable<?>> controlHandlerFunction;
            final boolean stopOnComplete;
            final boolean stopOnError;
        Severity: Minor
        Found in src/main/java/rx/internal/operators/OnSubscribeRedo.java - About 3 hrs to fix

          OneItemPerf has 31 methods (exceeds 20 allowed). Consider refactoring.
          Open

          @BenchmarkMode(Mode.Throughput)
          @OutputTimeUnit(TimeUnit.SECONDS)
          @State(Scope.Thread)
          public class OneItemPerf {
          
          
          Severity: Minor
          Found in src/perf/java/rx/OneItemPerf.java - About 3 hrs to fix

            Method drain has 94 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    void drain() {
                        if (wip.getAndIncrement() != 0) {
                            return;
                        }
            
            
            Severity: Major
            Found in src/main/java/rx/internal/operators/OnSubscribeFlattenIterable.java - About 3 hrs to fix

              File TestSubscriber.java has 323 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /**
               * Copyright 2014 Netflix, Inc.
               *
               * Licensed under the Apache License, Version 2.0 (the "License");
               * you may not use this file except in compliance with the License.
              Severity: Minor
              Found in src/main/java/rx/observers/TestSubscriber.java - About 3 hrs to fix

                Method emitLoop has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                Open

                    public void emitLoop() {
                        for (;;) {
                            long localRequested;
                            long localProduced;
                            Producer localProducer;
                Severity: Minor
                Found in src/main/java/rx/internal/producers/ProducerArbiter.java - About 3 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 tryEnableCancelPolicy has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static boolean tryEnableCancelPolicy(ScheduledExecutorService executor) {
                        if (SHOULD_TRY_ENABLE_CANCEL_POLICY) { // NOPMD
                            final boolean isInstanceOfScheduledThreadPoolExecutor = executor instanceof ScheduledThreadPoolExecutor;
                
                            Method methodToCall;
                Severity: Minor
                Found in src/main/java/rx/internal/schedulers/NewThreadWorker.java - About 3 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 dispatch has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        void dispatch() {
                            // standard construct of emitter loop (blocking)
                            // if there is an emission going on, indicate that more work needs to be done
                            // the exact nature of this work needs to be determined from other data structures
                            synchronized (this) {
                Severity: Major
                Found in src/main/java/rx/internal/operators/OperatorPublish.java - About 3 hrs to fix

                  Method call has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Override
                      public void call(final CompletableSubscriber s) {
                          final CompositeSubscription set = new CompositeSubscription();
                  
                          s.onSubscribe(set);

                    AtomicPerf has 30 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    @BenchmarkMode(Mode.Throughput)
                    @OutputTimeUnit(TimeUnit.SECONDS)
                    public class AtomicPerf {
                        @State(Scope.Thread)
                        public static class Times {
                    Severity: Minor
                    Found in src/perf/java/rx/internal/AtomicPerf.java - About 3 hrs to fix

                      File OperatorSwitch.java has 317 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /**
                       * Copyright 2014 Netflix, Inc.
                       *
                       * Licensed under the Apache License, Version 2.0 (the "License"); you may not
                       * use this file except in compliance with the License. You may obtain a copy of
                      Severity: Minor
                      Found in src/main/java/rx/internal/operators/OperatorSwitch.java - About 3 hrs to fix

                        Method drain has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                void drain() {
                                    if (wip.getAndIncrement() != 0) {
                                        return;
                                    }
                                    int missed = 1;
                        Severity: Major
                        Found in src/main/java/rx/internal/operators/OperatorEagerConcatMap.java - About 3 hrs to fix

                          Method init has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              @SuppressWarnings({ "rawtypes", "unchecked", "deprecation"})
                              static void init() {
                                  onError = new Action1<Throwable>() {
                                      @Override
                                      public void call(Throwable e) {
                          Severity: Major
                          Found in src/main/java/rx/plugins/RxJavaHooks.java - About 3 hrs to fix

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                                    @SuppressWarnings("unchecked")
                                    void remove(ReplayProducer<T> rp) {
                                        for (;;) {
                                            ReplayProducer<T>[] a = get();
                                            if (a == TERMINATED || a == EMPTY) {
                            Severity: Major
                            Found in src/main/java/rx/subjects/ReplaySubject.java and 1 other location - About 3 hrs to fix
                            src/main/java/rx/subjects/PublishSubject.java on lines 180..214

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 210.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Severity
                            Category
                            Status
                            Source
                            Language