zcommon/src/main/java/org/zkoss/lang/Strings.java

Summary

Maintainability
F
5 days
Test Coverage

File Strings.java has 479 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* Strings.java


    Purpose: String utilities and constants
    Description:
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 7 hrs to fix

    Strings has 37 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class Strings {
        /** Used with {@link #escape} to escape a string in
         * JavaScript. It assumes the string will be enclosed with a single quote.
         */
        public static final String ESCAPE_JAVASCRIPT = "'\n\r\t\f\\/!";
    Severity: Minor
    Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 4 hrs to fix

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

          public static final String escape(String src, String specials) {
              if (src == null)
                  return null;
      
              final char[] chars = src.toCharArray();
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 3 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 nextToken has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          public static final Result nextToken(String src, int from,
          char[] separators, boolean escBackslash, boolean quotAsToken,
          boolean parenthesis)
          throws IllegalSyntaxException {
              final int len = src.length();
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 3 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 nextSeparator has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          public static int nextSeparator(String src, int from, char[] separators,
          boolean escBackslash, boolean escQuot, boolean quotAsSeparator,
          boolean parenthesis) {
              boolean esc = false;
              char quot = (char)0, endparen;
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 3 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 escape has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public static final
          StringBuilder escape(StringBuilder dst, CharSequence src, String specials) {
              if (src == null)
                  return dst;
              String str = src.toString();
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/lang/Strings.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 escape has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public static final
          StringBuffer escape(StringBuffer dst, CharSequence src, String specials) {
              if (src == null)
                  return dst;
      
      
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/lang/Strings.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 escape has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static final String escape(String src, String specials) {
              if (src == null)
                  return null;
      
              final char[] chars = src.toCharArray();
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 1 hr to fix

        Method trim has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public static final StringBuffer trim(StringBuffer buf,
            final int index) {
                for (int j = index, len = buf.length();; ++j) {
                    if (j >= len) {
                        buf.delete(index, len);
        Severity: Minor
        Found in zcommon/src/main/java/org/zkoss/lang/Strings.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 nextToken has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static final Result nextToken(String src, int from,
            char[] separators, boolean escBackslash, boolean quotAsToken,
            boolean parenthesis)
            throws IllegalSyntaxException {
                final int len = src.length();
        Severity: Minor
        Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 1 hr to fix

          Method escape has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static final
              StringBuilder escape(StringBuilder dst, CharSequence src, String specials) {
                  if (src == null)
                      return dst;
                  String str = src.toString();
          Severity: Minor
          Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 1 hr to fix

            Method substring has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                public static final
                Result substring(String src, int from, char until, boolean escBackslash) {
                    final int len = src.length();
                    final StringBuilder sb = new StringBuilder(len);
                    for (boolean quoted = false; from < len; ++from) {
            Severity: Minor
            Found in zcommon/src/main/java/org/zkoss/lang/Strings.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 escapeSpecial has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                private static char escapeSpecial(CharSequence src,
                char cc, int k, String specials) {
                    switch (cc) {
                    case '\n': return 'n'; 
                    case '\t': return 't';
            Severity: Minor
            Found in zcommon/src/main/java/org/zkoss/lang/Strings.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 escape has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static final
                StringBuffer escape(StringBuffer dst, CharSequence src, String specials) {
                    if (src == null)
                        return dst;
            
            
            Severity: Minor
            Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 1 hr to fix

              Method nextSeparator has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static int nextSeparator(String src, int from, char[] separators,
                  boolean escBackslash, boolean escQuot, boolean quotAsSeparator,
                  boolean parenthesis) {
              Severity: Major
              Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 50 mins to fix

                Method nextToken has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public static final Result nextToken(String src, int from,
                    char[] separators, boolean escBackslash, boolean quotAsToken,
                    boolean parenthesis)
                Severity: Minor
                Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 45 mins to fix

                  Method nextSeparator has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public static int nextSeparator(String src, int from, char[] separators,
                      boolean escBackslash, boolean escQuot, boolean quotAsSeparator) {
                  Severity: Minor
                  Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 45 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                                if (ESCAPE_JAVASCRIPT.equals(specials) // handle it specially
                                        && (k <= 0 || src.charAt(k - 1) != '<'
                                                || k + 8 > src.length() || !("script>"
                                                .equalsIgnoreCase((key = src.subSequence(k + 1,
                                                        k + 8).toString())) || "script "
                    Severity: Major
                    Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 40 mins to fix

                      Method nextToken has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public static final Result nextToken(String src, int from,
                          char[] separators, boolean escBackslash, boolean quotAsToken)
                      Severity: Minor
                      Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 35 mins to fix

                        Method unescape has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static final String unescape(String s) {
                                if (s == null)
                                    return null;
                                StringBuilder sb = null;
                                int j = 0;
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/Strings.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 getEndingParenthesis has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private static final char getEndingParenthesis(char cc) {
                                return cc == '{' ? '}': cc == '(' ? ')': cc == '[' ? ']': (char)0;
                            }
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/Strings.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 skipParenthesis has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private static int skipParenthesis(String src, int j, char beg, char end) {
                                for (int len = src.length(), depth = 0; ++j < len;) {
                                    final char cc = src.charAt(j);
                                    if (cc == '\\') ++j; //skip next
                                    else if (cc == beg) ++depth;
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/Strings.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

                            private static int skipParenthesis(String src, int j, char beg, char end) {
                                for (int len = src.length(), depth = 0; ++j < len;) {
                                    final char cc = src.charAt(j);
                                    if (cc == '\\') ++j; //skip next
                                    else if (cc == beg) ++depth;
                        Severity: Major
                        Found in zcommon/src/main/java/org/zkoss/lang/Strings.java and 1 other location - About 1 hr to fix
                        zcommon/src/main/java/org/zkoss/util/Maps.java on lines 619..628

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

                        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 3 locations. Consider refactoring.
                        Open

                                    switch (cc) {
                                    case 'n': cc = '\n'; break;
                                    case 't': cc = '\t'; break;
                                    case 'r': cc = '\r'; break;
                                    case 'f': cc = '\f'; break;
                        Severity: Major
                        Found in zcommon/src/main/java/org/zkoss/lang/Strings.java and 2 other locations - About 50 mins to fix
                        zcommon/src/main/java/org/zkoss/lang/Strings.java on lines 527..532
                        zweb/src/main/java/org/zkoss/web/servlet/dsp/action/ForEach.java on lines 374..387

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

                        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 3 locations. Consider refactoring.
                        Open

                                        switch (cc) {
                                        case 'f': cc = '\f'; break;
                                        case 'n': cc = '\n'; break;
                                        case 'r': cc = '\r'; break;
                                        case 't': cc = '\t'; break;
                        Severity: Major
                        Found in zcommon/src/main/java/org/zkoss/lang/Strings.java and 2 other locations - About 50 mins to fix
                        zcommon/src/main/java/org/zkoss/lang/Strings.java on lines 481..486
                        zweb/src/main/java/org/zkoss/web/servlet/dsp/action/ForEach.java on lines 374..387

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

                        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

                                    if (v < 10) {
                                        sb.append((char)('0' + v));
                                    } else {
                                        sb.append((char)(v + ((int)'a' - 10)));
                                    }
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/Strings.java and 1 other location - About 40 mins to fix
                        zcommon/src/main/java/org/zkoss/lang/Strings.java on lines 129..133

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

                        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

                                    if (v < 10) {
                                        sb.append((char)('0' + v));
                                    } else {
                                        sb.append((char)(v + ((int)'a' - 10)));
                                    }
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/Strings.java and 1 other location - About 40 mins to fix
                        zcommon/src/main/java/org/zkoss/lang/Strings.java on lines 104..108

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

                        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

                                    if (enc == null
                                    && (cc = escapeSpecial(src, cc, k, specials)) == (char)0) {
                                        j2 = k + 1;
                                        continue;
                                    }
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/Strings.java and 2 other locations - About 40 mins to fix
                        zcommon/src/main/java/org/zkoss/lang/Strings.java on lines 383..387
                        zcommon/src/main/java/org/zkoss/lang/Strings.java on lines 430..434

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

                        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

                                    if (enc == null
                                    && (cc = escapeSpecial(src, cc, k, specials)) == (char)0) {
                                        j2 = k + 1;
                                        continue;
                                    }
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/Strings.java and 2 other locations - About 40 mins to fix
                        zcommon/src/main/java/org/zkoss/lang/Strings.java on lines 305..309
                        zcommon/src/main/java/org/zkoss/lang/Strings.java on lines 430..434

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

                        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

                                    if (enc == null
                                            && (cc = escapeSpecial(src, cc, k, specials)) == (char)0) {
                                        j2 = k + 1;
                                        continue;
                                    }
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/Strings.java and 2 other locations - About 40 mins to fix
                        zcommon/src/main/java/org/zkoss/lang/Strings.java on lines 305..309
                        zcommon/src/main/java/org/zkoss/lang/Strings.java on lines 383..387

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

                        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

                            private static final char getEndingParenthesis(char cc) {
                                return cc == '{' ? '}': cc == '(' ? ')': cc == '[' ? ']': (char)0;
                            }
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/Strings.java and 1 other location - About 30 mins to fix
                        zcommon/src/main/java/org/zkoss/util/Maps.java on lines 612..614

                        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