deeplearning4j/deeplearning4j

View on GitHub
datavec/datavec-api/src/main/java/org/datavec/api/transform/TransformProcess.java

Summary

Maintainability
F
5 days
Test Coverage

File TransformProcess.java has 655 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Builder has 68 methods (exceeds 20 allowed). Consider refactoring.
    Open

        public static class Builder {
    
            private List<DataAction> actionList = new ArrayList<>();
            private Schema initialSchema;
    
    

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

          private Pair<List<Writable>, List<List<Writable>>> execute(List<Writable> currEx, List<List<Writable>> currSeq){
              for (DataAction d : actionList) {
                  if (d.getTransform() != null) {
                      Transform t = d.getTransform();
      
      

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

          public Schema getSchemaAfterStep(int step) {
              Schema currInputSchema = initialSchema;
              int i = 0;
              for (DataAction d : actionList) {
                  if (d.getTransform() != 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 execute has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private Pair<List<Writable>, List<List<Writable>>> execute(List<Writable> currEx, List<List<Writable>> currSeq){
              for (DataAction d : actionList) {
                  if (d.getTransform() != null) {
                      Transform t = d.getTransform();
      
      

        Method getSchemaAfterStep has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public Schema getSchemaAfterStep(int step) {
                Schema currInputSchema = initialSchema;
                int i = 0;
                for (DataAction d : actionList) {
                    if (d.getTransform() != null) {

          Method normalize has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public Builder normalize(String column, Normalize type, DataAnalysis da) {
          
                      ColumnAnalysis ca = da.getColumnAnalysis(column);
                      if (!(ca instanceof NumericalColumnAnalysis))
                          throw new IllegalStateException(

            Method transformRawStringsToInputList has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public List<Writable> transformRawStringsToInputList(List<String> values) {
                    List<Writable> ret = new ArrayList<>();
                    if (values.size() != initialSchema.numColumns())
                        throw new IllegalArgumentException(
                                String.format("Number of values %d does not match the number of input columns %d for schema",

              Method executeSequenceToSequence has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public List<List<Writable>> executeSequenceToSequence(List<List<Writable>> input) {
                      List<List<Writable>> currValues = input;
              
                      for (DataAction d : actionList) {
                          if (d.getTransform() != 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 execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public List<Writable> execute(List<Writable> input) {
                      List<Writable> currValues = input;
              
                      for (DataAction d : actionList) {
                          if (d.getTransform() != 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 inferCategories has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static Map<Integer,List<String>> inferCategories(RecordReader recordReader,int[] columnIndices) {
                      if(columnIndices == null || columnIndices.length < 1) {
                          return Collections.emptyMap();
                      }
              
              

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

                      public Builder normalize(String column, Normalize type, DataAnalysis da) {
              
                          ColumnAnalysis ca = da.getColumnAnalysis(column);
                          if (!(ca instanceof NumericalColumnAnalysis))
                              throw new IllegalStateException(

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

                  public static TransformProcess fromJson(String json) {
                      try {
                          return JsonMappers.getMapper().readValue(json, TransformProcess.class);
                      } catch (InvalidTypeIdException e){
                          if(e.getMessage().contains("@class")){

              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

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

                  public static TransformProcess fromJson(String json) {
                      try {
                          return JsonMappers.getMapper().readValue(json, TransformProcess.class);
                      } catch (InvalidTypeIdException e){
                          if(e.getMessage().contains("@class")){
              datavec/datavec-api/src/main/java/org/datavec/api/transform/schema/Schema.java on lines 351..368

              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 78.

              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

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

                          } else if (d.getConvertToSequence() != null) {
                              throw new RuntimeException(
                                      "Cannot execute examples individually: TransformProcess contains a ConvertToSequence operation");
                          } else if (d.getConvertFromSequence() != null) {
                              throw new RuntimeException(
              datavec/datavec-api/src/main/java/org/datavec/api/transform/TransformProcess.java on lines 227..238

              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 66.

              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

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

                          } else if (d.getConvertToSequence() != null) {
                              throw new RuntimeException(
                                      "Cannot execute examples individually: TransformProcess contains a ConvertToSequence operation");
                          } else if (d.getConvertFromSequence() != null) {
                              throw new RuntimeException(
              datavec/datavec-api/src/main/java/org/datavec/api/transform/TransformProcess.java on lines 261..272

              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 66.

              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

              There are no issues that match your filters.

              Category
              Status