ReactiveX/RxJava

View on GitHub
src/main/java/rx/internal/operators/OnSubscribePublishMulticast.java

Summary

Maintainability
D
2 days
Test Coverage

Method drain has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    void drain() {
        if (getAndIncrement() != 0) {
            return;
        }

Severity: Minor
Found in src/main/java/rx/internal/operators/OnSubscribePublishMulticast.java - About 6 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 checkTerminated has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    boolean checkTerminated(boolean d, boolean empty) {
        if (d) {
            if (delayError) {
                if (empty) {
                    PublishProducer<T>[] a = terminate();
Severity: Minor
Found in src/main/java/rx/internal/operators/OnSubscribePublishMulticast.java - About 5 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

File OnSubscribePublishMulticast.java has 301 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Copyright 2016 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/OnSubscribePublishMulticast.java - About 3 hrs to fix

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

        void drain() {
            if (getAndIncrement() != 0) {
                return;
            }
    
    

      Method checkTerminated has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          boolean checkTerminated(boolean d, boolean empty) {
              if (d) {
                  if (delayError) {
                      if (empty) {
                          PublishProducer<T>[] a = terminate();

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

            @SuppressWarnings("unchecked")
            void remove(PublishProducer<T> inner) {
                PublishProducer<T>[] a = subscribers;
                if (a == TERMINATED || a == EMPTY) {
                    return;

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

              @SuppressWarnings("unchecked")
              void remove(PublishProducer<T> inner) {
                  PublishProducer<T>[] a = subscribers;
                  if (a == TERMINATED || a == EMPTY) {
                      return;

          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 8 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public void call(Subscriber<? super T> t) {
                  PublishProducer<T> pp = new PublishProducer<T>(t, this);
                  t.add(pp);
                  t.setProducer(pp);
          Severity: Minor
          Found in src/main/java/rx/internal/operators/OnSubscribePublishMulticast.java - 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

          Avoid deeply nested control flow statements.
          Open

                                  for (PublishProducer<T> inner : a) {
                                      inner.actual.onError(ex);
                                  }
          Severity: Major
          Found in src/main/java/rx/internal/operators/OnSubscribePublishMulticast.java - About 45 mins to fix

            There are no issues that match your filters.

            Category
            Status