deeplearning4j/deeplearning4j

View on GitHub

Showing 13,976 of 13,976 total issues

Method fromFlatBuffers has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    public static SameDiff fromFlatBuffers(ByteBuffer bbIn, boolean loadUpdaterState) throws IOException {

        FlatGraph fg = FlatGraph.getRootAsFlatGraph(bbIn);

        int numOps = fg.nodesLength();

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 walk has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    protected Sequence<V> walk(Vertex<V> node, int cDepth) {
        Sequence<V> sequence = new Sequence<>();

        int idx = node.vertexID();
        List<Vertex<V>> vertices = sourceGraph.getConnectedVertices(idx);

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 JavaSourceArgDescriptorSource.java has 832 lines of code (exceeds 250 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

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

    Method preOpExecution has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

        @Override
        public void preOpExecution(SameDiff sd, At at, SameDiffOp op, OpContext opContext) {
            if(lastIter != at.iteration()){
                lastIter = at.iteration();
                stepThisIter = 0;

    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 write has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

        @Override
        public PartitionMetaData write(List<Writable> record) throws IOException {
            if (!record.isEmpty()) {
                List<Writable> recordList = record instanceof List ? (List<Writable>) record : new ArrayList<>(record);
    
    

    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 DynamicCustomOp.java has 821 lines of code (exceeds 250 allowed). Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

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

      File VariationalAutoencoder.java has 818 lines of code (exceeds 250 allowed). Consider refactoring.
      Open
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

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

        File Nd4jNamespaceGenerator.java has 808 lines of code (exceeds 250 allowed). Consider refactoring.
        Open
        • Open
        • Confirmed
        • Invalid
        • Wontfix
        Cancel

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

          File NDBase.java has 790 lines of code (exceeds 250 allowed). Consider refactoring.
          Open
          • Open
          • Confirmed
          • Invalid
          • Wontfix
          Cancel

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

            Function ChartScatter has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
            Open
            • Open
            • Confirmed
            • Invalid
            • Wontfix
            Cancel

            var ChartScatter = (function (_super) {
                __extends(ChartScatter, _super);
                function ChartScatter(jsonStr) {
                    var _this = _super.call(this, ComponentType.ChartScatter, jsonStr) || this;
                    _this.render = function (appendToObject) {

            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

            CpuNDArrayFactory has 97 methods (exceeds 20 allowed). Consider refactoring.
            Open
            • Open
            • Confirmed
            • Invalid
            • Wontfix
            Cancel

            @Slf4j
            public class CpuNDArrayFactory extends BaseNativeNDArrayFactory {
            
                protected ThreadLocal<PointerPointer> extrazA = new ThreadLocal<>();
                protected ThreadLocal<PointerPointer> extrazB = new ThreadLocal<>();

              Method getOutputs has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
              Open
              • Open
              • Confirmed
              • Invalid
              • Wontfix
              Cancel

                  @Override
                  public ExecutionResult getOutputs(Pair<SameDiffOp, OpContext> opPair, FrameIter outputFrameIter, Set<VarId> opInputs, Set<VarId> allIterInputs,
                                                    Set<String> constAndPhInputs, List<Listener> listeners, At at, MultiDataSet batch, Set<String> allReqVariables, Map<String, SDValue> otherPlaceHolders) {
                      //Get outputs from InferenceSession
                      ExecutionResult out = super.getOutputs(opPair, outputFrameIter, opInputs, allIterInputs, constAndPhInputs, listeners, at, batch, allReqVariables, otherPlaceHolders);

              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

              DataBuffer has 96 methods (exceeds 20 allowed). Consider refactoring.
              Open
              • Open
              • Confirmed
              • Invalid
              • Wontfix
              Cancel

              public interface DataBuffer extends Serializable, AutoCloseable, Deallocatable {
                  enum TypeEx {
              
                  }
              
              

                Method mapFlatPropertiesToFunctionProperties has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
                Open
                • Open
                • Confirmed
                • Invalid
                • Wontfix
                Cancel

                    public static Map<String, Object> mapFlatPropertiesToFunctionProperties(Iterable<FlatProperties> list) {
                        Map<String, Object> out = new HashMap<>();
                        for (FlatProperties p : list) {
                
                            String name = p.name();

                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 convertWritablesSequence has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
                Open
                • Open
                • Confirmed
                • Invalid
                • Wontfix
                Cancel

                    private Pair<INDArray, INDArray> convertWritablesSequence(List<List<List<Writable>>> list, int minValues,
                                    int maxTSLength, SubsetDetails details, int[] longestSequence, long rngSeed) {
                        if (maxTSLength == -1)
                            maxTSLength = list.get(0).size();
                        INDArray arr;

                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 init has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
                Open
                • Open
                • Confirmed
                • Invalid
                • Wontfix
                Cancel

                    public void init(INDArray parameters, boolean cloneParametersArray) {
                        if (initCalled)
                            return;
                
                        DataType netDtype = getConfiguration().getDataType();

                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

                JCublasNDArrayFactory has 95 methods (exceeds 20 allowed). Consider refactoring.
                Open
                • Open
                • Confirmed
                • Invalid
                • Wontfix
                Cancel

                @Slf4j
                public class JCublasNDArrayFactory extends BaseNativeNDArrayFactory {
                
                
                    public JCublasNDArrayFactory() { }

                  Method checkGradients has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
                  Open
                  • Open
                  • Confirmed
                  • Invalid
                  • Wontfix
                  Cancel

                      public static boolean checkGradients(MLNConfig c) {
                  
                          //Basic sanity checks on input:
                          if (c.epsilon <= 0.0 || c.epsilon > 0.1)
                              throw new IllegalArgumentException("Invalid epsilon: expect epsilon in range (0,0.1], usually 1e-4 or so");

                  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 outputOfLayerDetached has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
                  Open
                  • Open
                  • Confirmed
                  • Invalid
                  • Wontfix
                  Cancel

                      protected INDArray outputOfLayerDetached(boolean train, @NonNull FwdPassType fwdPassType, int layerIndex, @NonNull INDArray input,
                                                               INDArray featureMask, INDArray labelsMask, MemoryWorkspace outputWorkspace){
                          setInput(input);
                          setLayerMaskArrays(featureMask, labelsMask);
                  
                  

                  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 Configuration.java has 767 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open
                  • Open
                  • Confirmed
                  • Invalid
                  • Wontfix
                  Cancel

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

                    File CudaDataBufferFactory.java has 763 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open
                    • Open
                    • Confirmed
                    • Invalid
                    • Wontfix
                    Cancel

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

                      Method createGradFunction has 355 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open
                      • Open
                      • Confirmed
                      • Invalid
                      • Wontfix
                      Cancel

                          public void createGradFunction(final String... variablesRequiringGradients) {
                              if(this.sameDiffFunctionInstances.containsKey(GRAD_FN_KEY))
                                  sameDiffFunctionInstances.remove(GRAD_FN_KEY);
                              List<String> lossInferred = bestGuessLossVariables();
                              //Check for external errors function

                        File NativeOps.java has 758 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open
                        • Open
                        • Confirmed
                        • Invalid
                        • Wontfix
                        Cancel

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

                          File DefaultOpExecutioner.java has 758 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open
                          • Open
                          • Confirmed
                          • Invalid
                          • Wontfix
                          Cancel

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

                            Method markSatisfied has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
                            Open
                            • Open
                            • Confirmed
                            • Invalid
                            • Wontfix
                            Cancel

                                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 checkActivationGradients has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
                            Open
                            • Open
                            • Confirmed
                            • Invalid
                            • Wontfix
                            Cancel

                                public static boolean checkActivationGradients(ActGradConfig config){
                                    SameDiff sd = config.getSd();
                                    List<String> actGrads = config.getActivationGradsToCheck();
                                    double maxRelError = config.getMaxRelError();
                                    double minAbsError = config.getMinAbsError();

                            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 88 (exceeds 5 allowed). Consider refactoring.
                            Open
                            • Open
                            • Confirmed
                            • Invalid
                            • Wontfix
                            Cancel

                                public static MultiLayerConfiguration fromJson(String json) {
                                    MultiLayerConfiguration conf;
                                    ObjectMapper mapper = NeuralNetConfiguration.mapper();
                                    try {
                                        conf = mapper.readValue(json, MultiLayerConfiguration.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

                            Function ChartLine has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
                            Open
                            • Open
                            • Confirmed
                            • Invalid
                            • Wontfix
                            Cancel

                            var ChartLine = (function (_super) {
                                __extends(ChartLine, _super);
                                function ChartLine(jsonStr) {
                                    var _this = _super.call(this, ComponentType.ChartLine, jsonStr) || this;
                                    _this.render = function (appendToObject) {

                            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 ArrowConverter.java has 751 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open
                            • Open
                            • Confirmed
                            • Invalid
                            • Wontfix
                            Cancel

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

                              BaseCudaDataBuffer has 91 methods (exceeds 20 allowed). Consider refactoring.
                              Open
                              • Open
                              • Confirmed
                              • Invalid
                              • Wontfix
                              Cancel

                              public abstract class BaseCudaDataBuffer extends BaseDataBuffer implements JCudaBuffer, Deallocatable {
                              
                                  @Getter
                                  protected transient volatile AllocationPoint allocationPoint;
                                  public final static long BASE_CUDA_DATA_BUFFER_OFFSET = RandomUtils.nextLong();

                                UpdateDecoder has 91 methods (exceeds 20 allowed). Consider refactoring.
                                Open
                                • Open
                                • Confirmed
                                • Invalid
                                • Wontfix
                                Cancel

                                @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
                                  • Open
                                  • Confirmed
                                  • Invalid
                                  • Wontfix
                                  Cancel

                                  /*
                                   *  ******************************************************************************
                                   *  *
                                   *  *
                                   *  * 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
                                    • Open
                                    • Confirmed
                                    • Invalid
                                    • Wontfix
                                    Cancel

                                        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
                                    • Open
                                    • Confirmed
                                    • Invalid
                                    • Wontfix
                                    Cancel

                                        @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
                                    • Open
                                    • Confirmed
                                    • Invalid
                                    • Wontfix
                                    Cancel

                                        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
                                      • Open
                                      • Confirmed
                                      • Invalid
                                      • Wontfix
                                      Cancel

                                      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
                                        • Open
                                        • Confirmed
                                        • Invalid
                                        • Wontfix
                                        Cancel

                                        @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
                                          • Open
                                          • Confirmed
                                          • Invalid
                                          • Wontfix
                                          Cancel

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

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open
                                            • Open
                                            • Confirmed
                                            • Invalid
                                            • Wontfix
                                            Cancel

                                            /*
                                             *  ******************************************************************************
                                             *  *
                                             *  *
                                             *  * 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

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open
                                            • Open
                                            • Confirmed
                                            • Invalid
                                            • Wontfix
                                            Cancel

                                            /*
                                             *  ******************************************************************************
                                             *  *
                                             *  *
                                             *  * 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

                                            DefaultOpExecutioner has 88 methods (exceeds 20 allowed). Consider refactoring.
                                            Open
                                            • Open
                                            • Confirmed
                                            • Invalid
                                            • Wontfix
                                            Cancel

                                            @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
                                              • Open
                                              • Confirmed
                                              • Invalid
                                              • Wontfix
                                              Cancel

                                              @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
                                                • Open
                                                • Confirmed
                                                • Invalid
                                                • Wontfix
                                                Cancel

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

                                                  Evaluation has 87 methods (exceeds 20 allowed). Consider refactoring.
                                                  Open
                                                  • Open
                                                  • Confirmed
                                                  • Invalid
                                                  • Wontfix
                                                  Cancel

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

                                                    File ComputationGraphConfiguration.java has 715 lines of code (exceeds 250 allowed). Consider refactoring.
                                                    Open
                                                    • Open
                                                    • Confirmed
                                                    • Invalid
                                                    • Wontfix
                                                    Cancel

                                                    /*
                                                     *  ******************************************************************************
                                                     *  *
                                                     *  *
                                                     *  * 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
                                                      • Open
                                                      • Confirmed
                                                      • Invalid
                                                      • Wontfix
                                                      Cancel

                                                          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
                                                      • Open
                                                      • Confirmed
                                                      • Invalid
                                                      • Wontfix
                                                      Cancel

                                                          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
                                                      • Open
                                                      • Confirmed
                                                      • Invalid
                                                      • Wontfix
                                                      Cancel

                                                          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
                                                      • Open
                                                      • Confirmed
                                                      • Invalid
                                                      • Wontfix
                                                      Cancel

                                                      /*
                                                       *  ******************************************************************************
                                                       *  *
                                                       *  *
                                                       *  * 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
                                                        • Open
                                                        • Confirmed
                                                        • Invalid
                                                        • Wontfix
                                                        Cancel

                                                            @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