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

Summary

Maintainability
F
5 days
Test Coverage

InputElement has 85 methods (exceeds 20 allowed). Consider refactoring.
Open

public abstract class InputElement extends XulElement implements Constrainted, Readonly, Disable {
    private static final Logger log = LoggerFactory.getLogger(InputElement.class);

    static {
        addClientEvent(InputElement.class, Events.ON_CHANGE, CE_IMPORTANT | CE_REPEAT_IGNORE);
Severity: Major
Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java - About 1 day to fix

    File InputElement.java has 619 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* InputElement.java
    
        Purpose:
            
        Description:
    Severity: Major
    Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java - About 1 day to fix

      Method service has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public void service(org.zkoss.zk.au.AuRequest request, boolean everError) {
              final String cmd = request.getCommand();
              if (cmd.equals(Events.ON_CHANGE)) {
                  try {
                      final Object oldval = _value;
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.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 renderProperties has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException {
              super.renderProperties(renderer);
      
              render(renderer, "_value", marshall(_value));
              //ZK-658: we have to render the value before constraint
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.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 service has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public void service(org.zkoss.zk.au.AuRequest request, boolean everError) {
              final String cmd = request.getCommand();
              if (cmd.equals(Events.ON_CHANGE)) {
                  try {
                      final Object oldval = _value;
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java - About 1 hr to fix

        Method setConstraint has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public void setConstraint(Constraint constr) {
                if (!Objects.equals(_auxinf != null ? _auxinf.constr : null, constr)) {
                    initAuxInfoForInputElement().constr = constr;
                    _valided = false;
        
        
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.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 renderProperties has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException {
                super.renderProperties(renderer);
        
                render(renderer, "_value", marshall(_value));
                //ZK-658: we have to render the value before constraint
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java - About 1 hr to fix

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

              public void setSelectedText(int start, int end, String newtxt, boolean isHighLight) {
                  if (start <= end) {
                      final String txt = getText();
                      final int len = txt.length();
                      if (start < 0)
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.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 setValueByClient has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private void setValueByClient(Object value, String valstr) {
                  if (_auxinf != null && _auxinf.maxlength > 0 && valstr != null && valstr.length() > _auxinf.maxlength)
                      throw new WrongValueException(this, MZul.STRING_TOO_LONG, new Integer(_auxinf.maxlength));
          
                  final boolean same = Objects.equals(_value, value);
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              protected void validate(Object value) throws WrongValueException {
                  final Constraint constr = getConstraint();
                  if (constr != null) { //then _auxinf must be non-null
                      //Bug 1698190: constructor might be zscript
                      Scopes.beforeInterpret(this);
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method setText has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public void setText(String value) throws WrongValueException {
                  if (_auxinf != null && _auxinf.maxlength > 0 && value != null && value.length() > _auxinf.maxlength)
                      throw new WrongValueException(this, MZul.STRING_TOO_LONG, new Integer(_auxinf.maxlength));
          
                  final Object val = coerceFromString(value);
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              public boolean isValid() {
                  if (_auxinf != null && _auxinf.errmsg != null)
                      return false;
          
                  if (!_valided && _auxinf != null && _auxinf.constr != null) {
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.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

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

              public void setErrorboxIconSclass(String iconSclass) {
                  if (iconSclass != null && iconSclass.length() == 0)
                      iconSclass = null;
                  if (!Objects.equals(_auxinf != null ? _auxinf.errorboxSclass : null, iconSclass)) {
                      initAuxInfoForInputElement().errorboxIconSclass = iconSclass;
          Severity: Major
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java and 6 other locations - About 1 hr to fix
          zul/src/main/java/org/zkoss/zul/A.java on lines 163..171
          zul/src/main/java/org/zkoss/zul/Button.java on lines 214..222
          zul/src/main/java/org/zkoss/zul/Menuitem.java on lines 232..240
          zul/src/main/java/org/zkoss/zul/impl/InputElement.java on lines 181..188
          zul/src/main/java/org/zkoss/zul/impl/InputElement.java on lines 755..762
          zul/src/main/java/org/zkoss/zul/impl/XulElement.java on lines 106..113

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

              public void setName(String name) {
                  if (name != null && name.length() == 0)
                      name = null;
                  if (!Objects.equals(_auxinf != null ? _auxinf.name : null, name)) {
                      initAuxInfoForInputElement().name = name;
          Severity: Major
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java and 6 other locations - About 1 hr to fix
          zul/src/main/java/org/zkoss/zul/A.java on lines 163..171
          zul/src/main/java/org/zkoss/zul/Button.java on lines 214..222
          zul/src/main/java/org/zkoss/zul/Menuitem.java on lines 232..240
          zul/src/main/java/org/zkoss/zul/impl/InputElement.java on lines 755..762
          zul/src/main/java/org/zkoss/zul/impl/InputElement.java on lines 778..785
          zul/src/main/java/org/zkoss/zul/impl/XulElement.java on lines 106..113

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

              public void setErrorboxSclass(String sclass) {
                  if (sclass != null && sclass.length() == 0)
                      sclass = null;
                  if (!Objects.equals(_auxinf != null ? _auxinf.errorboxSclass : null, sclass)) {
                      initAuxInfoForInputElement().errorboxSclass = sclass;
          Severity: Major
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java and 6 other locations - About 1 hr to fix
          zul/src/main/java/org/zkoss/zul/A.java on lines 163..171
          zul/src/main/java/org/zkoss/zul/Button.java on lines 214..222
          zul/src/main/java/org/zkoss/zul/Menuitem.java on lines 232..240
          zul/src/main/java/org/zkoss/zul/impl/InputElement.java on lines 181..188
          zul/src/main/java/org/zkoss/zul/impl/InputElement.java on lines 778..785
          zul/src/main/java/org/zkoss/zul/impl/XulElement.java on lines 106..113

          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

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

                  if (!same || !_valided || (_auxinf != null && _auxinf.errmsg != null)) { //note: the first time (!_valided) must always validate
                      validate(value); //Bug 2946917: don't validate if not changed
          
                      errFound = _auxinf != null && _auxinf.errmsg != null;
                      clearErrorMessage(); //no error at all
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java and 1 other location - About 55 mins to fix
          zul/src/main/java/org/zkoss/zul/impl/InputElement.java on lines 311..316

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

          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 (!same || !_valided || (_auxinf != null && _auxinf.errmsg != null)) { //note: the first time (!_valided) must always validate
                      validate(val); //Bug 2946917: don't validate if not changed
          
                      errFound = _auxinf != null && _auxinf.errmsg != null;
                      clearErrorMessage(); //no error at all
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java and 1 other location - About 55 mins to fix
          zul/src/main/java/org/zkoss/zul/impl/InputElement.java on lines 868..873

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

          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 class AuxInfo implements java.io.Serializable, Cloneable {
                  /** The error message. Not null if users entered a wrong data (and
                   * not correct it yet).
                   */
                  private String errmsg;
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java and 1 other location - About 45 mins to fix
          zul/src/main/java/org/zkoss/zul/impl/LabelImageElement.java on lines 519..544

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

          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 (_auxinf != null && _auxinf.maxlength > 0 && valstr != null && valstr.length() > _auxinf.maxlength)
                      throw new WrongValueException(this, MZul.STRING_TOO_LONG, new Integer(_auxinf.maxlength));
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java and 1 other location - About 45 mins to fix
          zul/src/main/java/org/zkoss/zul/impl/InputElement.java on lines 303..304

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

          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 (_auxinf != null && _auxinf.maxlength > 0 && value != null && value.length() > _auxinf.maxlength)
                      throw new WrongValueException(this, MZul.STRING_TOO_LONG, new Integer(_auxinf.maxlength));
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java and 1 other location - About 45 mins to fix
          zul/src/main/java/org/zkoss/zul/impl/InputElement.java on lines 863..864

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

          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

              public void setCols(int cols) throws WrongValueException {
                  if (cols < 0)
                      throw new WrongValueException("Illegal cols: " + cols);
          
                  if (_cols != cols) {
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java and 1 other location - About 40 mins to fix
          zul/src/main/java/org/zkoss/zul/Paging.java on lines 153..160

          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

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

                  if ((_auxinf != null ? _auxinf.maxlength : 0) != maxlength) {
                      initAuxInfoForInputElement().maxlength = maxlength;
                      smartUpdate("maxlength", getMaxlength());
                  }
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java and 1 other location - About 30 mins to fix
          zul/src/main/java/org/zkoss/zul/Label.java on lines 79..82

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

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

              public Object clone() {
                  final InputElement clone = (InputElement) super.clone();
                  if (_auxinf != null)
                      clone._auxinf = (AuxInfo) _auxinf.clone();
                  return clone;
          Severity: Major
          Found in zul/src/main/java/org/zkoss/zul/impl/InputElement.java and 10 other locations - About 30 mins to fix
          zk/src/main/java/org/zkoss/zk/ui/HtmlBasedComponent.java on lines 1057..1062
          zul/src/main/java/org/zkoss/zul/Button.java on lines 282..287
          zul/src/main/java/org/zkoss/zul/Cell.java on lines 112..117
          zul/src/main/java/org/zkoss/zul/Label.java on lines 188..193
          zul/src/main/java/org/zkoss/zul/Listcell.java on lines 60..65
          zul/src/main/java/org/zkoss/zul/Menuitem.java on lines 278..283
          zul/src/main/java/org/zkoss/zul/Textbox.java on lines 223..228
          zul/src/main/java/org/zkoss/zul/Treecell.java on lines 125..130
          zul/src/main/java/org/zkoss/zul/impl/LabelImageElement.java on lines 503..508
          zul/src/main/java/org/zkoss/zul/impl/XulElement.java on lines 485..490

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

          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