deeplearning4j/deeplearning4j

View on GitHub
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/internal/AbstractDependencyTracker.java

Summary

Maintainability
F
3 days
Test Coverage

Method markSatisfied has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
Open

    public void markSatisfied(@NonNull D x, boolean satisfied) {

        if (satisfied) {
            boolean alreadySatisfied = satisfiedDependencies.contains(x);

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 markSatisfied has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void markSatisfied(@NonNull D x, boolean satisfied) {

        if (satisfied) {
            boolean alreadySatisfied = satisfiedDependencies.contains(x);

    Method checkAndUpdateIfAllSatisfied has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        protected void checkAndUpdateIfAllSatisfied(@NonNull T y) {
    
            boolean allSat = isAllSatisfied(y);
            if (allSat) {
                // Case where "x is satisfied" happened before x->y added

    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 AbstractDependencyTracker.java has 275 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     *  ******************************************************************************
     *  *
     *  *
     *  * This program and the accompanying materials are made available under the

      Method removeDependency has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public void removeDependency(@NonNull T y, @NonNull D x) {
      
              dependencies.removeGroupReturn(y, t -> t.equals(x));
      
              Set<T> s2 = reverseDependencies.get(x);

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

          protected boolean isAllSatisfied(@NonNull T y) {
      
              Iterable<D> set1 = dependencies.getDependantsForEach(y);
      
              boolean retVal = true;

      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 checkAndUpdateIfAllSatisfied has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected void checkAndUpdateIfAllSatisfied(@NonNull T y) {
      
              boolean allSat = isAllSatisfied(y);
              if (allSat) {
                  // Case where "x is satisfied" happened before x->y added

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

            public void removeDependency(@NonNull T y, @NonNull D x) {
        
                dependencies.removeGroupReturn(y, t -> t.equals(x));
        
                Set<T> s2 = reverseDependencies.get(x);

          Avoid deeply nested control flow statements.
          Open

                                  for (D d : it) {
                                      if (!isSatisfied(d)) {
                                          allSatisfied = false;
                                          break;
                                      }

            Avoid deeply nested control flow statements.
            Open

                                    if (itOr != null) {
                                        for (Pair<D, D> p : itOr) {
                                            if (!isSatisfied(p.getFirst()) && !isSatisfied(p.getSecond())) {
                                                allSatisfied = false;
                                                break;

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

                  public T getFirstNewAllSatisfiedMatching(@NonNull Predicate<T> predicate) {
                      Preconditions.checkState(hasNewAllSatisfied(), "No new/unprocessed dependents that are all satisfied");
              
                      T t = allSatisfiedQueue.peek();
                      if (predicate.test(t)) {

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

                  public void clear() {
                      dependencies.clear();
                      orDependencies.clear();
                      reverseDependencies.clear();
                      reverseOrDependencies.clear();

              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

              There are no issues that match your filters.

              Category
              Status