deeplearning4j/deeplearning4j

View on GitHub

Showing 13,975 of 13,975 total issues

UpdateDecoder has 91 methods (exceeds 20 allowed). Consider refactoring.
Open

@javax.annotation.Generated(value = {"org.deeplearning4j.ui.stats.sbe.UpdateDecoder"})
@SuppressWarnings("all")
public class UpdateDecoder {
    public static final int BLOCK_LENGTH = 32;
    public static final int TEMPLATE_ID = 2;

    File RecordReaderMultiDataSetIterator.java has 740 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      Method doExec has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
      Open

          public double doExec(List<BatchItem<T>> items, INDArray inferenceVector) {
              try(MemoryWorkspace workspace = Nd4j.getWorkspaceManager().scopeOutOfWorkspaces()) {
                  boolean useHS = configuration.isUseHierarchicSoftmax();
                  boolean useNegative = configuration.getNegative() > 0;
                  boolean useInference = inferenceVector != 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 deserialize has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public MultiLayerConfiguration deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
              long charOffsetStart = jp.getCurrentLocation().getCharOffset();
      
              MultiLayerConfiguration conf = (MultiLayerConfiguration) defaultDeserializer.deserialize(jp, ctxt);

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

          public ExecutionResult output(@NonNull List<String> variables,
                  Map<String, T> placeholderValues,
                  Map<String, SDValue> otherPlaceHolderValues,
                  MultiDataSet batch,
                  Collection<String> requiredActivations,

        VectorsConfiguration has 90 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public class VectorsConfiguration implements Serializable {
        
            // word2vec params
            private Integer minWordFrequency = 5;
            private Double learningRate = 0.025;

          WordVectorSerializer has 89 methods (exceeds 20 allowed). Consider refactoring.
          Open

          @Slf4j
          public class WordVectorSerializer {
              private static final int MAX_SIZE = 50;
              private static final String WHITESPACE_REPLACEMENT = "_Az92_";
          
          

            File BaseCpuDataBuffer.java has 724 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

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

              /*
               *  ******************************************************************************
               *  *
               *  *
               *  * This program and the accompanying materials are made available under the
              nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/rng/distribution/impl/TruncatedNormalDistribution.java on lines 1..335

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

              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

              /*
               *  ******************************************************************************
               *  *
               *  *
               *  * This program and the accompanying materials are made available under the
              nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/rng/distribution/impl/LogNormalDistribution.java on lines 1..335

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

              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

              DefaultOpExecutioner has 88 methods (exceeds 20 allowed). Consider refactoring.
              Open

              @Slf4j
              public abstract class DefaultOpExecutioner implements OpExecutioner {
              
                  private static final String SCOPE_PANIC_MSG = "For more details, see the ND4J User Guide: https://deeplearning4j.konduit.ai/nd4j/overview#workspaces-scope-panic";
              
              

                DataSet has 88 methods (exceeds 20 allowed). Consider refactoring.
                Open

                @Slf4j
                public class DataSet implements org.nd4j.linalg.dataset.api.DataSet {
                
                    private static final long serialVersionUID = 1935520764586513365L;
                
                

                  File CpuNDArrayFactory.java has 722 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

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

                    Evaluation has 87 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    @Slf4j
                    @EqualsAndHashCode(callSuper = true)
                    @Getter
                    @Setter
                    @JsonIgnoreProperties({"confusionMatrixMetaData"})

                      File ComputationGraphConfiguration.java has 715 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

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

                        Method getOpCode has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static int getOpCode(Op op) {
                                int code = -1;
                        
                                String name = op.opName();
                        
                        

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

                            public static void logCoverageInformation(boolean logAdequatelyTested, boolean logInadequate, boolean logUnmappedLibnd4jOps,
                                                                      boolean logUntestedTFImport, boolean logUnmappedTFOps) {
                                //Set of ops that we can't gradient check
                                Set<Class> excludedFromBackpropCoverage = excludedFromGradientCheckCoverage();
                                Set<Class> excludedFromAllTestCoverage = excludedFromAllTests();

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

                            public static KerasLayer getKerasLayerFromConfig(Map<String, Object> layerConfig,
                                                                             boolean enforceTrainingConfig,
                                                                             KerasLayerConfiguration conf,
                                                                             Map<String, Class<? extends KerasLayer>> customLayers,
                                                                             Map<String, SameDiffLambdaLayer> lambdaLayers,

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

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

                          Method eval has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring.
                          Open

                              @Override
                              public void eval(INDArray labels, INDArray predictions, INDArray mask, final List<? extends Serializable> recordMetaData) {
                                  Triple<INDArray,INDArray, INDArray> p = BaseEvaluation.reshapeAndExtractNotMasked(labels, predictions, mask, axis);
                                  if(p == null){
                                      //All values masked out; no-op

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language