zul/src/main/java/org/zkoss/zul/impl/NumberInputElement.java

Summary

Maintainability
D
2 days
Test Coverage

Method toNumberOnly has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
Open

    protected Object[] toNumberOnly(String val) {
        if (val == null)
            return new Object[] { null, null };

        final DecimalFormatSymbols symbols = new DecimalFormatSymbols(getDefaultLocale());
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/impl/NumberInputElement.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 toNumberOnly has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected Object[] toNumberOnly(String val) {
        if (val == null)
            return new Object[] { null, null };

        final DecimalFormatSymbols symbols = new DecimalFormatSymbols(getDefaultLocale());
Severity: Major
Found in zul/src/main/java/org/zkoss/zul/impl/NumberInputElement.java - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

                if (!ignore)
                    ignore = (cc < '0' || cc > '9') && cc != DECIMAL && cc != MINUS && cc != '+'
                            && (Character.isWhitespace(cc) || cc == GROUPING || cc == ')'
                                    || (fmt != null && fmt.indexOf(cc) >= 0));
    Severity: Critical
    Found in zul/src/main/java/org/zkoss/zul/impl/NumberInputElement.java - About 2 hrs to fix

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

          protected String formatNumber(Object value, String defaultFormat) {
              if (value == null)
                  return "";
      
              final DecimalFormat df = (DecimalFormat) NumberFormat.getInstance(getDefaultLocale());
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/impl/NumberInputElement.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

      There are no issues that match your filters.

      Category
      Status