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

Summary

Maintainability
F
6 days
Test Coverage

Method syncModel has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

    public void syncModel(int offset, int limit) {
        int min = offset;
        int max = offset + limit - 1;

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

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

    Method doListDataChange has a Cognitive Complexity of 39 (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/GridDataLoader.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

    GridDataLoader has 36 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class GridDataLoader implements DataLoader, Cropper {
        private Grid _grid;
    
        //--DataLoader--//
        public void init(Component owner, int offset, int limit) {
    Severity: Minor
    Found in zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java - About 4 hrs to fix

      Method syncModel has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public void syncModel(int offset, int limit) {
              int min = offset;
              int max = offset + limit - 1;
      
              final ListModel model = _grid.getModel();
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java - About 3 hrs to fix

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

                public void render(final Row row, final Object data, final int index) {
                    final Rows rows = (Rows) row.getParent();
                    final Grid grid = (Grid) rows.getParent();
                    Template tm = getTemplate(grid, rows, "model");
                    GroupingInfo info = null;
        Severity: Major
        Found in zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java - About 3 hrs to fix

          Method getAvailableAtClient has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              protected Set<? extends Component> getAvailableAtClient(int offset, int limit) {
                  final Set<Component> avail = new LinkedHashSet<Component>(32);
                  final Rows rows = _grid.getRows();
                  Row row = (Row) rows.getFirstChild();
                  while (row != null) {
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.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 doListDataChange has 61 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/GridDataLoader.java - About 2 hrs to fix

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

                    public void render(final Row row, final Object data, final int index) {
                        final Rows rows = (Rows) row.getParent();
                        final Grid grid = (Grid) rows.getParent();
                        Template tm = getTemplate(grid, rows, "model");
                        GroupingInfo info = null;
            Severity: Minor
            Found in zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.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

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

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

            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/GridDataLoader.java and 1 other location - About 1 hr to fix
            zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java on lines 217..233

            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 Row newRow(RowRenderer renderer) {
                    Row row = null;
                    if (renderer instanceof RowRendererExt)
                        row = ((RowRendererExt) renderer).newRow((Grid) getOwner());
                    if (row == null) {
            Severity: Major
            Found in zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java and 2 other locations - About 55 mins to fix
            zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 219..228
            zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 230..239

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

            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 Groupfoot newGroupfoot(RowRenderer renderer) {
                    Groupfoot groupfoot = null;
                    if (renderer instanceof GroupRendererExt)
                        groupfoot = ((GroupRendererExt) renderer).newGroupfoot((Grid) getOwner());
                    if (groupfoot == null) {
            Severity: Major
            Found in zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java and 2 other locations - About 55 mins to fix
            zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 208..217
            zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 219..228

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 64.

            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 Group newGroup(RowRenderer renderer) {
                    Group group = null;
                    if (renderer instanceof GroupRendererExt)
                        group = ((GroupRendererExt) renderer).newGroup((Grid) getOwner());
                    if (group == null) {
            Severity: Major
            Found in zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java and 2 other locations - About 55 mins to fix
            zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 208..217
            zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 230..239

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

            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/GridDataLoader.java and 1 other location - About 50 mins to fix
            zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java on lines 487..493

            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

                    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/GridDataLoader.java and 1 other location - About 40 mins to fix
            zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java on lines 408..409

            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

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

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

                private static Label newRenderLabel(String value) {
                    final Label label = new Label(value != null && value.length() > 0 ? value : " ");
                    label.setPre(true); //to make sure &nbsp; is generated, and then occupies some space
                    return label;
                }
            Severity: Minor
            Found in zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java and 2 other locations - About 35 mins to fix
            zkbind/src/main/java/org/zkoss/bind/impl/BindRowRenderer.java on lines 143..147
            zul/src/main/java/org/zkoss/zul/Grid.java on lines 1159..1163

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

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

            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/GridDataLoader.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/ListboxDataLoader.java on lines 158..161

            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/GridDataLoader.java and 1 other location - About 35 mins to fix
            zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java on lines 420..423

            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/GridDataLoader.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/ListboxDataLoader.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 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/GridDataLoader.java and 1 other location - About 30 mins to fix
            zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java on lines 416..419

            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