zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java

Summary

Maintainability
F
1 wk
Test Coverage

Method indexOf has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
Open

    public static final int indexOf(Object o, Object element) {
        if (o instanceof String) {
            return element instanceof String ?
                ((String)o).indexOf((String)element): -1;
        } else if (o instanceof Collection) {
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 1 day 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 lastIndexOf has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
Open

    public static final int lastIndexOf(Object o, Object element) {
        if (o instanceof String) {
            return element instanceof String ?
                ((String)o).lastIndexOf((String)element): -1;
        } else if (o instanceof List) {
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 1 day 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

File CommonFns.java has 370 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* CommonFns.java

    Purpose:
        
    Description:
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 4 hrs to fix

    CommonFns has 28 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class CommonFns {
        private static final Logger log = LoggerFactory.getLogger(CommonFns.class);
    
        protected CommonFns() {}
    
    
    Severity: Minor
    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 3 hrs to fix

      Method indexOf has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static final int indexOf(Object o, Object element) {
              if (o instanceof String) {
                  return element instanceof String ?
                      ((String)o).indexOf((String)element): -1;
              } else if (o instanceof Collection) {
      Severity: Major
      Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 3 hrs to fix

        Method lastIndexOf has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static final int lastIndexOf(Object o, Object element) {
                if (o instanceof String) {
                    return element instanceof String ?
                        ((String)o).lastIndexOf((String)element): -1;
                } else if (o instanceof List) {
        Severity: Major
        Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 3 hrs to fix

          Method toStyle has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              private static final int toStyle (String style) {
                  if (style != null) {
                      style = style.trim().toLowerCase(java.util.Locale.ENGLISH);
                      return "short".equals(style) ? DateFormat.SHORT
                              : "medium".equals(style) ? DateFormat.MEDIUM
          Severity: Minor
          Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.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 getLabel has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              public static final String getLabel(String key) {
                  if (key == null)
                      return "";
          
                  if (key.startsWith("mesg:")) {
          Severity: Minor
          Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.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 formatDate has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static final String formatDate(Date date, String pattern, Locale locale, TimeZone timezone, String dateStyle, String timeStyle) {
          Severity: Minor
          Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 45 mins to fix

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

                public static final Date parseDate(String source, String pattern, Locale locale, TimeZone timezone, String dateStyle, String timeStyle) throws Exception {
            Severity: Minor
            Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 45 mins to fix

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

                  private static final DateFormat getDateFormat (String pattern, Locale locale, TimeZone timezone, String dateStyle, String timeStyle) {
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 35 mins to fix

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

                    public static boolean isInstance(Object c, Object o) {
                        if (c instanceof Class) {
                            return ((Class)c).isInstance(o);
                        } else if (c instanceof String) {
                            try {
                Severity: Minor
                Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.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 length has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static final int length(Object o) {
                        if (o instanceof String) {
                            return ((String)o).length();
                        } else if (o == null) {
                            return 0;
                Severity: Minor
                Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.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

                Avoid too many return statements within this method.
                Open

                            return indexOf(((Map)o).keySet(), element);
                Severity: Major
                Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return -1;
                  Severity: Major
                  Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return element instanceof String ?
                                    ((String)o).indexOf((String)element): -1;
                    Severity: Major
                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                              return j;
                      Severity: Major
                      Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                                return j;
                        Severity: Major
                        Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                                  return j;
                          Severity: Major
                          Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                                return j;
                            Severity: Major
                            Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                                      return j;
                              Severity: Major
                              Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            return ((String)o).length();
                                Severity: Major
                                Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                      return j;
                                  Severity: Major
                                  Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                            return j;
                                    Severity: Major
                                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                              return j;
                                      Severity: Major
                                      Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                return -1;
                                        Severity: Major
                                        Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                                  return j;
                                          Severity: Major
                                          Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                                return j;
                                            Severity: Major
                                            Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                                  return j - 1;
                                              Severity: Major
                                              Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                            return element instanceof String ?
                                                                ((String)o).lastIndexOf((String)element): -1;
                                                Severity: Major
                                                Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                                          return j;
                                                  Severity: Major
                                                  Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 30 mins to fix

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

                                                            } else if (o instanceof float[]) {
                                                                if (element instanceof Number) {
                                                                    float v = ((Number)element).floatValue();
                                                                    final float[] ary = (float[])o;
                                                                    for (int j = 0; j < ary.length; j++)
                                                    Severity: Major
                                                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java and 1 other location - About 1 hr to fix
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 220..228

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

                                                    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

                                                            } else if (o instanceof double[]) {
                                                                if (element instanceof Number) {
                                                                    double v = ((Number)element).doubleValue();
                                                                    final double[] ary = (double[])o;
                                                                    for (int j = 0; j < ary.length; j++)
                                                    Severity: Major
                                                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java and 1 other location - About 1 hr to fix
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 228..236

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

                                                    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

                                                            } else if (o instanceof float[]) {
                                                                if (element instanceof Number) {
                                                                    float v = ((Number)element).floatValue();
                                                                    final float[] ary = (float[])o;
                                                                    for (int j = ary.length; --j >= 0;)
                                                    Severity: Major
                                                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java and 1 other location - About 1 hr to fix
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 304..312

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

                                                    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

                                                            } else if (o instanceof double[]) {
                                                                if (element instanceof Number) {
                                                                    double v = ((Number)element).doubleValue();
                                                                    final double[] ary = (double[])o;
                                                                    for (int j = ary.length; --j >= 0;)
                                                    Severity: Major
                                                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java and 1 other location - About 1 hr to fix
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 312..320

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

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

                                                            } else if (o instanceof int[]) {
                                                                if (element instanceof Number) {
                                                                    int v = ((Number)element).intValue();
                                                                    final int[] ary = (int[])o;
                                                                    for (int j = 0; j < ary.length; j++)
                                                    Severity: Major
                                                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java and 3 other locations - About 1 hr to fix
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 212..220
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 204..212
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 196..204

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

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

                                                            } else if (o instanceof short[]) {
                                                                if (element instanceof Number) {
                                                                    short v = ((Number)element).shortValue();
                                                                    final short[] ary = (short[])o;
                                                                    for (int j = 0; j < ary.length; j++)
                                                    Severity: Major
                                                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java and 3 other locations - About 1 hr to fix
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 212..220
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 196..204
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 188..196

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

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

                                                            } else if (o instanceof byte[]) {
                                                                if (element instanceof Number) {
                                                                    byte v = ((Number)element).byteValue();
                                                                    final byte[] ary = (byte[])o;
                                                                    for (int j = 0; j < ary.length; j++)
                                                    Severity: Major
                                                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java and 3 other locations - About 1 hr to fix
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 204..212
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 196..204
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 188..196

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

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

                                                            } else if (o instanceof long[]) {
                                                                if (element instanceof Number) {
                                                                    long v = ((Number)element).longValue();
                                                                    final long[] ary = (long[])o;
                                                                    for (int j = 0; j < ary.length; j++)
                                                    Severity: Major
                                                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java and 3 other locations - About 1 hr to fix
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 212..220
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 204..212
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 188..196

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

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

                                                            } else if (o instanceof short[]) {
                                                                if (element instanceof Number) {
                                                                    short v = ((Number)element).shortValue();
                                                                    final short[] ary = (short[])o;
                                                                    for (int j = ary.length; --j >= 0;)
                                                    Severity: Major
                                                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java and 3 other locations - About 1 hr to fix
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 296..304
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 280..288
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 272..280

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

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

                                                            } else if (o instanceof byte[]) {
                                                                if (element instanceof Number) {
                                                                    byte v = ((Number)element).byteValue();
                                                                    final byte[] ary = (byte[])o;
                                                                    for (int j = ary.length; --j >= 0;)
                                                    Severity: Major
                                                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java and 3 other locations - About 1 hr to fix
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 288..296
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 280..288
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 272..280

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

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

                                                            } else if (o instanceof long[]) {
                                                                if (element instanceof Number) {
                                                                    long v = ((Number)element).longValue();
                                                                    final long[] ary = (long[])o;
                                                                    for (int j = ary.length; --j >= 0;)
                                                    Severity: Major
                                                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java and 3 other locations - About 1 hr to fix
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 296..304
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 288..296
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 272..280

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

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

                                                            } else if (o instanceof int[]) {
                                                                if (element instanceof Number) {
                                                                    int v = ((Number)element).intValue();
                                                                    final int[] ary = (int[])o;
                                                                    for (int j = ary.length; --j >= 0;)
                                                    Severity: Major
                                                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java and 3 other locations - About 1 hr to fix
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 296..304
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 288..296
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 280..288

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

                                                    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 (element instanceof Character)
                                                                    v = ((Character)element).charValue();
                                                                else if (element instanceof String && ((String)element).length() > 0)
                                                                    v = ((String)element).charAt(0);
                                                                else
                                                    Severity: Minor
                                                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java and 1 other location - About 50 mins to fix
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 238..243

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

                                                    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 (element instanceof Character)
                                                                    v = ((Character)element).charValue();
                                                                else if (element instanceof String && ((String)element).length() > 0)
                                                                    v = ((String)element).charAt(0);
                                                                else
                                                    Severity: Minor
                                                    Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java and 1 other location - About 50 mins to fix
                                                    zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java on lines 322..327

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

                                                    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