deeplearning4j/deeplearning4j

View on GitHub
nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java

Summary

Maintainability
F
4 days
Test Coverage

File StringUtils.java has 580 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 *  ******************************************************************************
 *  *
 *  *
 *  * This program and the accompanying materials are made available under the
Severity: Major
Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 1 day to fix

    StringUtils has 58 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public abstract class StringUtils {
        private static final String FOLDER_SEPARATOR = "/";
        private static final String WINDOWS_FOLDER_SEPARATOR = "\\";
        private static final String TOP_PATH = "..";
        private static final String CURRENT_PATH = ".";
    Severity: Major
    Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 1 day to fix

      Method cleanPath has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          public static String cleanPath(String path) {
              if (path == null) {
                  return null;
              } else {
                  String pathToUse = replace(path, "\\", "/");
      Severity: Minor
      Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 2 hrs to fix

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

          public static String[] delimitedListToStringArray(String str, String delimiter, String charsToDelete) {
              if (str == null) {
                  return new String[0];
              } else if (delimiter == null) {
                  return new String[] {str};
      Severity: Minor
      Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 2 hrs to fix

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

          public static String cleanPath(String path) {
              if (path == null) {
                  return null;
              } else {
                  String pathToUse = replace(path, "\\", "/");
      Severity: Minor
      Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 1 hr to fix

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

            public static String[] tokenizeToStringArray(String str, String delimiters, boolean trimTokens,
                            boolean ignoreEmptyTokens) {
                if (str == null) {
                    return null;
                } else {
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 1 hr to fix

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

            public static Properties splitArrayElementsIntoProperties(String[] array, String delimiter, String charsToDelete) {
                if (ObjectUtils.isEmpty(array)) {
                    return null;
                } else {
                    Properties result = new Properties();
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 1 hr to fix

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

            public static String stripFilenameExtension(String path) {
                if (path == null) {
                    return null;
                } else {
                    int extIndex = path.lastIndexOf(46);
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 45 mins to fix

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

            public static String[] mergeStringArrays(String[] array1, String[] array2) {
                if (ObjectUtils.isEmpty(array1)) {
                    return array2;
                } else if (ObjectUtils.isEmpty(array2)) {
                    return array1;
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 45 mins to fix

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

            public static String trimAllWhitespace(String str) {
                if (!hasLength(str)) {
                    return str;
                } else {
                    StringBuilder sb = new StringBuilder(str);
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 45 mins to fix

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

            public static String deleteAny(String inString, String charsToDelete) {
                if (hasLength(inString) && hasLength(charsToDelete)) {
                    StringBuilder sb = new StringBuilder();
        
                    for (int i = 0; i < inString.length(); ++i) {
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 45 mins to fix

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

            public static String getFilenameExtension(String path) {
                if (path == null) {
                    return null;
                } else {
                    int extIndex = path.lastIndexOf(46);
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 45 mins to fix

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

            public static String arrayToDelimitedString(Object[] arr, String delim) {
                if (ObjectUtils.isEmpty(arr)) {
                    return "";
                } else if (arr.length == 1) {
                    return ObjectUtils.nullSafeToString(arr[0]);
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 45 mins to fix

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

            public static String trimWhitespace(String str) {
                if (!hasLength(str)) {
                    return str;
                } else {
                    StringBuilder sb = new StringBuilder(str);
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 45 mins to fix

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

            public static boolean startsWithIgnoreCase(String str, String prefix) {
                if (str != null && prefix != null) {
                    if (str.startsWith(prefix)) {
                        return true;
                    } else if (str.length() < prefix.length()) {
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 35 mins to fix

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

            public static String[] trimArrayElements(String[] array) {
                if (ObjectUtils.isEmpty(array)) {
                    return new String[0];
                } else {
                    String[] result = new String[array.length];
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 35 mins to fix

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

            public static String collectionToDelimitedString(Collection<?> coll, String delim, String prefix, String suffix) {
                if (CollectionUtils.isEmpty(coll)) {
                    return "";
                } else {
                    StringBuilder sb = new StringBuilder();
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 35 mins to fix

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

            public static boolean containsWhitespace(CharSequence str) {
                if (!hasLength(str)) {
                    return false;
                } else {
                    int strLen = str.length();
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 35 mins to fix

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

            public static boolean endsWithIgnoreCase(String str, String suffix) {
                if (str != null && suffix != null) {
                    if (str.endsWith(suffix)) {
                        return true;
                    } else if (str.length() < suffix.length()) {
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 35 mins to fix

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

            public static boolean hasText(CharSequence str) {
                if (!hasLength(str)) {
                    return false;
                } else {
                    int strLen = str.length();
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 35 mins to fix

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

            private static String changeFirstCharacterCase(String str, boolean capitalize) {
                if (str != null && str.length() != 0) {
                    StringBuilder sb = new StringBuilder(str.length());
                    if (capitalize) {
                        sb.append(Character.toUpperCase(str.charAt(0)));
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 25 mins to fix

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

            public static Locale parseLocaleString(String localeString) {
                String[] parts = tokenizeToStringArray(localeString, "_ ", false, false);
                String language = parts.length > 0 ? parts[0] : "";
                String country = parts.length > 1 ? parts[1] : "";
                validateLocalePart(language);
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 25 mins to fix

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

            public static String[] split(String toSplit, String delimiter) {
                if (hasLength(toSplit) && hasLength(delimiter)) {
                    int offset = toSplit.indexOf(delimiter);
                    if (offset < 0) {
                        return null;
        Severity: Minor
        Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java - About 25 mins to fix

        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

                    while (sb.length() > 0 && Character.isWhitespace(sb.charAt(sb.length() - 1))) {
                        sb.deleteCharAt(sb.length() - 1);
                    }
        nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java on lines 144..146

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

        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

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

                    while (sb.length() > 0 && Character.isWhitespace(sb.charAt(sb.length() - 1))) {
                        sb.deleteCharAt(sb.length() - 1);
                    }
        nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java on lines 97..99

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

        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

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

                for (int i$ = 0; i$ < len$; ++i$) {
                    String token = arr$[i$];
                    set.add(token);
                }
        nd4j/nd4j-common/src/main/java/org/nd4j/common/io/CollectionUtils.java on lines 53..56
        nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java on lines 539..542

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

        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

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

                    for (int i$ = 0; i$ < len$; ++i$) {
                        String element = arr$[i$];
                        set.add(element);
                    }
        nd4j/nd4j-common/src/main/java/org/nd4j/common/io/CollectionUtils.java on lines 53..56
        nd4j/nd4j-common/src/main/java/org/nd4j/common/io/StringUtils.java on lines 659..662

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

        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