deeplearning4j/deeplearning4j

View on GitHub
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/inmemory/InMemoryLookupCache.java

Summary

Maintainability
D
1 day
Test Coverage

InMemoryLookupCache has 44 methods (exceeds 20 allowed). Consider refactoring.
Open

@Deprecated
public class InMemoryLookupCache implements VocabCache<VocabWord>, Serializable {

    private Index wordIndex = new Index();
    public Counter<String> wordFrequencies = Util.parallelCounter();

    File InMemoryLookupCache.java has 280 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

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

          @Override
          public boolean equals(Object o) {
              if (this == o)
                  return true;
              if (o == null || getClass() != o.getClass())

      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

      Avoid too many return statements within this method.
      Open

                  return true;

        Avoid too many return statements within this method.
        Open

                    return false;

          Avoid too many return statements within this method.
          Open

                  return true;

            Avoid too many return statements within this method.
            Open

                        return false;

              Method putVocabWord has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  @Override
                  @Deprecated
                  public synchronized void putVocabWord(String word) {
                      if (word == null || word.isEmpty())
                          throw new IllegalArgumentException("Word can't be empty or 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

              There are no issues that match your filters.

              Category
              Status