deeplearning4j/deeplearning4j

View on GitHub
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/listeners/impl/UIListener.java

Summary

Maintainability
F
5 days
Test Coverage

File UIListener.java has 469 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Method checkStructureForRestore has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

        protected void checkStructureForRestore(SameDiff sd){
            LogFileWriter.StaticInfo si;
            try {
                si = writer.readStatic();
            } catch (IOException e){

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

        @Override
        public void opExecution(SameDiff sd, At at, MultiDataSet batch, SameDiffOp op, OpContext opContext, INDArray[] outputs) {
    
    
            //Do training set evaluation, if required

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

        @Override
        public void iterationDone(SameDiff sd, At at, MultiDataSet dataSet, Loss loss) {
            long time = System.currentTimeMillis();
    
            //iterationDone method - just writes loss values (so far)

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

        @Override
        public ListenerResponse epochEnd(SameDiff sd, At at, LossCurve lossCurve, long epochTimeMillis) {
    
            //If any training evaluation, report it here:
            if(epochTrainEval != null){

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

        protected void checkStructureForRestore(SameDiff sd){
            LogFileWriter.StaticInfo si;
            try {
                si = writer.readStatic();
            } catch (IOException e){

      Method preUpdate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public void preUpdate(SameDiff sd, At at, Variable v, INDArray update) {
              if(writer == null)
                  initalizeWriter(sd);
      
      

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

          protected void restoreLogFile(){
              if(logFile.length() == 0 && fileMode == FileMode.CREATE_OR_APPEND || fileMode == FileMode.APPEND){
                  logFile.delete();
                  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 iterationDone has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          public void iterationDone(SameDiff sd, At at, MultiDataSet dataSet, Loss loss) {
              long time = System.currentTimeMillis();
      
              //iterationDone method - just writes loss values (so far)

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

            @Override
            public void opExecution(SameDiff sd, At at, MultiDataSet batch, SameDiffOp op, OpContext opContext, INDArray[] outputs) {
        
        
                //Do training set evaluation, if required

          Method preUpdate has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override
              public void preUpdate(SameDiff sd, At at, Variable v, INDArray update) {
                  if(writer == null)
                      initalizeWriter(sd);
          
          

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

                protected void restoreLogFile(){
                    if(logFile.length() == 0 && fileMode == FileMode.CREATE_OR_APPEND || fileMode == FileMode.APPEND){
                        logFile.delete();
                        return;
                    }

              Avoid deeply nested control flow statements.
              Open

                                      if(!vars.contains(s)){
                                          countDifferent++;
                                          if(different.size() < 10){
                                              different.add(s);
                                          }

                Avoid deeply nested control flow statements.
                Open

                                        if (!wroteEvalNamesIter) {
                                            if(!writer.registeredEventName(n)) {    //Might have been written previously if continuing training
                                                writer.registerEventNameQuiet(n);
                                            }
                                            wrote = true;

                  Method opExecution has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public void opExecution(SameDiff sd, At at, MultiDataSet batch, SameDiffOp op, OpContext opContext, INDArray[] outputs) {

                    Avoid deeply nested control flow statements.
                    Open

                                            if(!writer.registeredEventName(mName)) {    //Might have been registered if continuing training
                                                writer.registerEventNameQuiet(mName);
                                            }

                      There are no issues that match your filters.

                      Category
                      Status