zul/src/main/java/org/zkoss/zul/Listitem.java

Summary

Maintainability
D
1 day
Test Coverage

Listitem has 43 methods (exceeds 20 allowed). Consider refactoring.
Open

public class Listitem extends XulElement {

    private transient Object _value;
    /** The index in the parent (only for implementation purpose). */
    private int _index = -1; //no parent at beginning
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/Listitem.java - About 5 hrs to fix

    File Listitem.java has 257 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* Listitem.java
    
        Purpose:
            
        Description:
    Severity: Minor
    Found in zul/src/main/java/org/zkoss/zul/Listitem.java - About 2 hrs to fix

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

          public boolean setVisible(boolean visible) {
              if (isVisible() == visible)
                  return visible;
      
              final boolean result = super.setVisible(visible);
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Listitem.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 setValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public <T> void setValue(T value) {
              if (!Objects.equals(_value, value)) {
                  _value = value;
      
                  final Listbox listbox = getListbox();
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Listitem.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

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

          static {
              _properties.put("_loaded", new BooleanPropertyAccess() {
                  public void setValue(Component cmp, Boolean loaded) {
                      ((Listitem) cmp)._loaded = loaded;
                  }
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Listitem.java and 1 other location - About 1 hr to fix
      zul/src/main/java/org/zkoss/zul/Row.java on lines 259..278

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

      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

          /*package*/ void setLoaded(boolean loaded) {
              if (loaded != _loaded) {
                  _loaded = loaded;
      
                  final Listbox listbox = getListbox();
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Listitem.java and 1 other location - About 45 mins to fix
      zul/src/main/java/org/zkoss/zul/Row.java on lines 155..163

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          private Listcell autoFirstCell() {
              Listcell cell = (Listcell) getFirstChild();
              if (cell == null) {
                  cell = new Listcell();
                  cell.applyProperties();
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Listitem.java and 2 other locations - About 40 mins to fix
      zul/src/main/java/org/zkoss/zul/Listgroupfoot.java on lines 72..80
      zul/src/main/java/org/zkoss/zul/Treerow.java on lines 109..117

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          private synchronized void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
              s.defaultWriteObject();
      
              if (_value instanceof Serializable) {
                  s.writeBoolean(true);
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Listitem.java and 2 other locations - About 35 mins to fix
      zul/src/main/java/org/zkoss/zul/Comboitem.java on lines 227..236
      zul/src/main/java/org/zkoss/zul/Row.java on lines 345..354

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 44.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          protected void smartUpdate(String name, boolean value) { //make it accessible in this package
              Listbox box = getListbox();
              if (isVisible() || box == null || !box.inSelectMold())
                  super.smartUpdate(name, value);
          }
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Listitem.java and 2 other locations - About 35 mins to fix
      zul/src/main/java/org/zkoss/zul/Listitem.java on lines 293..297
      zul/src/main/java/org/zkoss/zul/Listitem.java on lines 305..309

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          protected void smartUpdate(String name, Object value) { //make it accessible in this package
              Listbox box = getListbox();
              if (isVisible() || box == null || !box.inSelectMold())
                  super.smartUpdate(name, value);
          }
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Listitem.java and 2 other locations - About 35 mins to fix
      zul/src/main/java/org/zkoss/zul/Listitem.java on lines 299..303
      zul/src/main/java/org/zkoss/zul/Listitem.java on lines 305..309

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          protected void smartUpdate(String name, int value) {
              Listbox box = getListbox();
              if (isVisible() || box == null || !box.inSelectMold())
                  super.smartUpdate(name, value);
          }
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Listitem.java and 2 other locations - About 35 mins to fix
      zul/src/main/java/org/zkoss/zul/Listitem.java on lines 293..297
      zul/src/main/java/org/zkoss/zul/Listitem.java on lines 299..303

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

      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

          public void setSelectable(boolean selectable) {
              if (_selectable != selectable) {
                  _selectable = selectable;
      
                  // non-checkable cannot be selected
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Listitem.java and 1 other location - About 30 mins to fix
      zul/src/main/java/org/zkoss/zul/Treeitem.java on lines 99..108

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 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

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

          protected class ExtraCtrl extends XulElement.ExtraCtrl implements LoadStatus {
              //-- LoadStatus --//
              public boolean isLoaded() {
                  return Listitem.this.isLoaded();
              }
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Listitem.java and 1 other location - About 30 mins to fix
      zul/src/main/java/org/zkoss/zul/Row.java on lines 373..386

      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