deeplearning4j/deeplearning4j

View on GitHub
datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/recordreader/BaseImageRecordReader.java

Summary

Maintainability
F
3 days
Test Coverage

Method next has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public List<List<Writable>> next(int num) {
        Preconditions.checkArgument(num > 0, "Number of examples must be > 0: got %s", num);

        if (imageLoader == 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

File BaseImageRecordReader.java has 410 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Method next has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        public List<Writable> next() {
            if(inputSplit instanceof InputStreamInputSplit) {
                InputStreamInputSplit inputStreamInputSplit = (InputStreamInputSplit) inputSplit;
                try {

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

        @Override
        public List<List<Writable>> next(int num) {
            Preconditions.checkArgument(num > 0, "Number of examples must be > 0: got %s", num);
    
            if (imageLoader == null) {

      BaseImageRecordReader has 25 methods (exceeds 20 allowed). Consider refactoring.
      Open

      @Slf4j
      public abstract class BaseImageRecordReader extends BaseRecordReader {
          protected boolean finishedInputStreamSplit;
          protected Iterator<File> iter;
          protected Configuration conf;

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

            @Override
            public void initialize(InputSplit split) throws IOException {
                if (imageLoader == null) {
                    imageLoader = new NativeImageLoader(height, width, channels, imageTransform);
                }

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

            @Override
            public List<Writable> next() {
                if(inputSplit instanceof InputStreamInputSplit) {
                    InputStreamInputSplit inputStreamInputSplit = (InputStreamInputSplit) inputSplit;
                    try {

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

              @Override
              public void initialize(InputSplit split) throws IOException {
                  if (imageLoader == null) {
                      imageLoader = new NativeImageLoader(height, width, channels, imageTransform);
                  }

            There are no issues that match your filters.

            Category
            Status