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

Summary

Maintainability
F
1 wk
Test Coverage

Method syncModel0 has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

    private void syncModel0(int offset, int limit) {
        int min = offset;
        int max = offset + limit - 1;

        final ListModel _model = _listbox.getModel();
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.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 ListboxDataLoader.java has 477 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* ListboxDataLoader.java
{{IS_NOTE
    Purpose:
        
    Description:
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java - About 7 hrs to fix

    Method doListDataChange has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        public void doListDataChange(ListDataEvent event) {
            if (INVALIDATE_THRESHOLD == -1) {
                INVALIDATE_THRESHOLD = Utils.getIntAttribute(this.getOwner(), "org.zkoss.zul.invalidateThreshold", 10,
                        true);
            }
    Severity: Minor
    Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java - About 6 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 getAvailableAtClient has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

        protected Set<? extends Component> getAvailableAtClient(int offset, int limit, boolean itemOnly) {
            final Set<Component> avail = new LinkedHashSet<Component>(32);
            if (!itemOnly) {
                avail.addAll(_listbox.getHeads());
                final Listfoot listfoot = _listbox.getListfoot();
    Severity: Minor
    Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java - About 5 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

    ListboxDataLoader has 38 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class ListboxDataLoader implements DataLoader, Cropper { //no need to serialize since Listbox assumes it
        private Listbox _listbox;
    
        //--DataLoader--//
        public void init(Component owner, int offset, int limit) {
    Severity: Minor
    Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java - About 5 hrs to fix

      Method syncModel0 has 83 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private void syncModel0(int offset, int limit) {
              int min = offset;
              int max = offset + limit - 1;
      
              final ListModel _model = _listbox.getModel();
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java - About 3 hrs to fix

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

                public void render(final Listitem item, final Object data, final int index) {
                    final Listbox listbox = (Listbox) item.getParent();
                    Template tm = listbox.getTemplate("model");
                    GroupingInfo info = null;
                    if (item instanceof Listgroup) {
        Severity: Major
        Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java - About 3 hrs to fix

          Method doListDataChange has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public void doListDataChange(ListDataEvent event) {
                  if (INVALIDATE_THRESHOLD == -1) {
                      INVALIDATE_THRESHOLD = Utils.getIntAttribute(this.getOwner(), "org.zkoss.zul.invalidateThreshold", 10,
                              true);
                  }
          Severity: Major
          Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java - About 2 hrs to fix

            Method render has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                    public void render(final Listitem item, final Object data, final int index) {
                        final Listbox listbox = (Listbox) item.getParent();
                        Template tm = listbox.getTemplate("model");
                        GroupingInfo info = null;
                        if (item instanceof Listgroup) {
            Severity: Minor
            Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.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 getAvailableAtClient has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected Set<? extends Component> getAvailableAtClient(int offset, int limit, boolean itemOnly) {
                    final Set<Component> avail = new LinkedHashSet<Component>(32);
                    if (!itemOnly) {
                        avail.addAll(_listbox.getHeads());
                        final Listfoot listfoot = _listbox.getListfoot();
            Severity: Minor
            Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java - About 1 hr to fix

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

                  private void invalidateListitems() {
                      //Bug 3147518: avoid memory leak
                      //Also better performance (outer better than remove a lot)
                      final Execution execution = Executions.getCurrent();
                      final String uuid = _listbox.getUuid();
              Severity: Minor
              Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.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

              Avoid deeply nested control flow statements.
              Open

                                      for (int j = 0, len = g.getItemCount(); j < len; j++)
                                          item = item.getNextSibling();
              Severity: Major
              Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java - About 45 mins to fix

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

                            } else {
                                final GroupingInfo groupingInfo = info;
                                final Component[] items = ShadowElementsCtrl
                                        .filterOutShadows(tm.create(listbox, item, new VariableResolver() {
                                    public Object resolveVariable(String name) {
                Severity: Major
                Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java and 1 other location - About 4 hrs to fix
                zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 291..363

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

                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 (model instanceof GroupsListModel) {
                            final GroupsListModel gmodel = (GroupsListModel) model;
                            final GroupingInfo info = gmodel.getDataInfo(index);
                            switch (info.getType()) {
                            case GroupDataInfo.GROUP:
                Severity: Major
                Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java and 1 other location - About 1 hr to fix
                zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 184..200

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

                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 Listgroup newListgroup(ListitemRenderer renderer) {
                        Listgroup group = null;
                        if (renderer instanceof ListgroupRendererExt)
                            group = ((ListgroupRendererExt) renderer).newListgroup(_listbox);
                        if (group == null) {
                Severity: Major
                Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java and 2 other locations - About 50 mins to fix
                zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java on lines 241..250
                zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java on lines 263..272

                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

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

                    private Listitem newListitem(ListitemRenderer renderer) {
                        Listitem item = null;
                        if (renderer instanceof ListitemRendererExt)
                            item = ((ListitemRendererExt) renderer).newListitem(_listbox);
                        if (item == null) {
                Severity: Major
                Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java and 2 other locations - About 50 mins to fix
                zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java on lines 252..261
                zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java on lines 263..272

                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

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

                    private Listgroupfoot newListgroupfoot(ListitemRenderer renderer) {
                        Listgroupfoot groupfoot = null;
                        if (renderer instanceof ListgroupRendererExt)
                            groupfoot = ((ListgroupRendererExt) renderer).newListgroupfoot(_listbox);
                        if (groupfoot == null) {
                Severity: Major
                Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java and 2 other locations - About 50 mins to fix
                zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java on lines 241..250
                zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java on lines 252..261

                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 (_pgi != null) {
                            if (atg >= _pgi.getPageCount())
                                atg = _pgi.getPageCount() - 1;
                            _pgi.setActivePage(atg);
                            if (_pgi.getTotalSize() != newsz)
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java and 1 other location - About 50 mins to fix
                zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 463..469

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 60.

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

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

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

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

                Refactorings

                Further Reading

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

                        for (; --newcnt >= 0; ++min) {
                            if (renderer == null)
                                renderer = (ListitemRenderer) getRealRenderer();
                            _listbox.insertBefore(newUnloadedItem(renderer, min), next);
                        }
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java and 1 other location - About 40 mins to fix
                zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 457..461

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 48.

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

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

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

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

                Refactorings

                Further Reading

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

                        final boolean shallInvalidated = //Bug 3147518: avoid memory leak
                        (min < 0 || min == 0) && (max < 0 || max >= newsz || max >= oldsz);
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java and 1 other location - About 40 mins to fix
                zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 383..384

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 48.

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

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

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

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

                Refactorings

                Further Reading

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

                            while (--cnt >= 0) {
                                if (renderer == null)
                                    renderer = (ListitemRenderer) getRealRenderer();
                                _listbox.insertBefore(newUnloadedItem(renderer, min++), next);
                            }
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java and 1 other location - About 35 mins to fix
                zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 130..134

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

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

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

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

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

                Refactorings

                Further Reading

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

                            if (min >= 0)
                                max = min + cnt - 1;
                            else if (max < 0)
                                max = cnt - 1; //0 ~ cnt - 1            
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java and 2 other locations - About 35 mins to fix
                zul/src/main/java/org/zkoss/zul/Combobox.java on lines 320..323
                zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 153..156

                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

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

                            if (max < 0)
                                max = oldsz - 1;
                            else if (max > oldsz - 1)
                                max = oldsz - 1;
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java and 1 other location - About 35 mins to fix
                zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 395..398

                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

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

                            if (min < 0)
                                if (max < 0)
                                    min = 0;
                                else
                                    min = max - cnt + 1;
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java and 2 other locations - About 30 mins to fix
                zul/src/main/java/org/zkoss/zul/Combobox.java on lines 276..280
                zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 120..124

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 40.

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

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

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

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

                Refactorings

                Further Reading

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

                            if (min < 0)
                                min = 0;
                            else if (min > oldsz - 1)
                                min = oldsz - 1;
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java and 1 other location - About 30 mins to fix
                zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 391..394

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 40.

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

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

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

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

                Refactorings

                Further Reading

                There are no issues that match your filters.

                Category
                Status