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

Summary

Maintainability
F
1 wk
Test Coverage

File Listheader.java has 541 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* Listheader.java

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

    Method group has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

        public boolean group(boolean ascending) {
            final String dir = getSortDirection();
            if (ascending) {
                if ("ascending".equals(dir))
                    return false;
    Severity: Minor
    Found in zul/src/main/java/org/zkoss/zul/Listheader.java - About 7 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 setSort has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

        public void setSort(String type) {
            if (type == null)
                return;
            if (type.startsWith("client")) {
                try {
    Severity: Minor
    Found in zul/src/main/java/org/zkoss/zul/Listheader.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

    Listheader has 39 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class Listheader extends HeaderElement {
        private static final long serialVersionUID = 20080218L;
    
        private String _sortDir = "natural";
        private transient Comparator _sortAsc, _sortDsc;
    Severity: Minor
    Found in zul/src/main/java/org/zkoss/zul/Listheader.java - About 5 hrs to fix

      Method writeObject has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          private synchronized void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
              s.defaultWriteObject();
      
              boolean written = false;
              if (_sortAsc instanceof ListitemComparator) {
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Listheader.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 group has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public boolean group(boolean ascending) {
              final String dir = getSortDirection();
              if (ascending) {
                  if ("ascending".equals(dir))
                      return false;
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Listheader.java - About 2 hrs to fix

        Method ungroup has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public void ungroup(boolean ascending) {
                final Comparator<?> cmpr = ascending ? _sortAsc : _sortDsc;
                if (cmpr != null) {
        
                    final Listbox listbox = getListbox();
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Listheader.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 setSort has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public void setSort(String type) {
                if (type == null)
                    return;
                if (type.startsWith("client")) {
                    try {
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Listheader.java - About 1 hr to fix

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

              /**/ boolean doSort(boolean ascending) {
                  final Comparator cmpr = ascending ? _sortAsc : _sortDsc;
                  if (cmpr == null)
                      return false;
          
          
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/Listheader.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 writeObject has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private synchronized void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
                  s.defaultWriteObject();
          
                  boolean written = false;
                  if (_sortAsc instanceof ListitemComparator) {
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/Listheader.java - About 1 hr to fix

            Method doSort has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                /**/ boolean doSort(boolean ascending) {
                    final Comparator cmpr = ascending ? _sortAsc : _sortDsc;
                    if (cmpr == null)
                        return false;
            
            
            Severity: Minor
            Found in zul/src/main/java/org/zkoss/zul/Listheader.java - About 1 hr to fix

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

                  public void setSortDirection(String sortDir) throws WrongValueException {
                      if (sortDir == null
                              || (!"ascending".equals(sortDir) && !"descending".equals(sortDir) && !"natural".equals(sortDir)))
                          throw new WrongValueException("Unknown sort direction: " + sortDir);
                      if (!Objects.equals(_sortDir, sortDir)) {
              Severity: Minor
              Found in zul/src/main/java/org/zkoss/zul/Listheader.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 ungroup has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public void ungroup(boolean ascending) {
                      final Comparator<?> cmpr = ascending ? _sortAsc : _sortDsc;
                      if (cmpr != null) {
              
                          final Listbox listbox = getListbox();
              Severity: Minor
              Found in zul/src/main/java/org/zkoss/zul/Listheader.java - About 1 hr to fix

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

                    private void fixClone() {
                        if (_sortAsc instanceof ListitemComparator) {
                            final ListitemComparator c = (ListitemComparator) _sortAsc;
                            if (c.getListheader() == this && c.isAscending())
                                _sortAsc = new ListitemComparator(this, true, c.shallIgnoreCase());
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Listheader.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 too many return statements within this method.
                Open

                                    return false; //Avoid listbox with null group
                Severity: Major
                Found in zul/src/main/java/org/zkoss/zul/Listheader.java - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return true;
                  Severity: Major
                  Found in zul/src/main/java/org/zkoss/zul/Listheader.java - About 30 mins to fix

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

                        public boolean sort(boolean ascending) {
                            final String dir = getSortDirection();
                            if (ascending) {
                                if ("ascending".equals(dir))
                                    return false;
                    Severity: Minor
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.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

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

                        private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
                            s.defaultReadObject();
                    
                            boolean b = s.readBoolean();
                            if (b) {
                    Severity: Minor
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.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

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

                        public void setSort(String type) {
                            if (type == null)
                                return;
                            if (type.startsWith("client")) {
                                try {
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 1 other location - About 6 hrs to fix
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 172..218

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

                    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

                        private synchronized void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
                            s.defaultWriteObject();
                    
                            boolean written = false;
                            if (_sortAsc instanceof ListitemComparator) {
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 1 other location - About 4 hrs to fix
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 525..569

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

                    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 service(org.zkoss.zk.au.AuRequest request, boolean everError) {
                            final String cmd = request.getCommand();
                            if (cmd.equals(Events.ON_SORT)) {
                                SortEvent evt = SortEvent.getSortEvent(request);
                                Events.postEvent(evt);
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 1 other location - About 2 hrs to fix
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 710..729

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

                    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 void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
                            s.defaultReadObject();
                    
                            boolean b = s.readBoolean();
                            if (b) {
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 1 other location - About 2 hrs to fix
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 571..593

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

                    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

                        public void setSortDirection(String sortDir) throws WrongValueException {
                            if (sortDir == null
                                    || (!"ascending".equals(sortDir) && !"descending".equals(sortDir) && !"natural".equals(sortDir)))
                                throw new WrongValueException("Unknown sort direction: " + sortDir);
                            if (!Objects.equals(_sortDir, sortDir)) {
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 2 other locations - About 2 hrs to fix
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 127..141
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 109..123

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

                    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

                        protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException {
                            super.renderProperties(renderer);
                    
                            if (!"none".equals(_sortDscNm))
                                render(renderer, "sortDescending", _sortDscNm);
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 1 other location - About 1 hr to fix
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 479..494

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

                    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

                        private void fixClone() {
                            if (_sortAsc instanceof ListitemComparator) {
                                final ListitemComparator c = (ListitemComparator) _sortAsc;
                                if (c.getListheader() == this && c.isAscending())
                                    _sortAsc = new ListitemComparator(this, true, c.shallIgnoreCase());
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 1 other location - About 1 hr to fix
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 510..521

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

                    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 Comparator toComparator(String clsnm)
                                throws ClassNotFoundException, InstantiationException, IllegalAccessException {
                            if (clsnm == null || clsnm.length() == 0)
                                return null;
                    
                    
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 2 other locations - About 1 hr to fix
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 321..333
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 296..308

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

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

                        public void setSortAscending(Comparator sorter) {
                            if (!Objects.equals(_sortAsc, sorter)) {
                                _sortAsc = sorter;
                                _isCustomAscComparator = _sortAsc != null;
                                String nm = _isCustomAscComparator ? "fromServer" : "none";
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 5 other locations - About 1 hr to fix
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 254..264
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 297..307
                    zul/src/main/java/org/zkoss/zul/Listheader.java on lines 318..328
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 233..243
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 271..281

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

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

                        public void setSortDescending(Comparator sorter) {
                            if (!Objects.equals(_sortDsc, sorter)) {
                                _sortDsc = sorter;
                                _isCustomDscComparator = _sortDsc != null;
                                String nm = _isCustomDscComparator ? "fromServer" : "none";
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 5 other locations - About 1 hr to fix
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 254..264
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 297..307
                    zul/src/main/java/org/zkoss/zul/Listheader.java on lines 275..285
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 233..243
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 271..281

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

                    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

                        private void fixDirection(Listbox listbox, boolean ascending) {
                            _ignoreSort = true;
                            //maintain
                            for (Iterator it = listbox.getListhead().getChildren().iterator(); it.hasNext();) {
                                final Listheader hd = (Listheader) it.next();
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 1 other location - About 1 hr to fix
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 460..468

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

                    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 (box.hasGroup())
                                for (Listgroup g : box.getGroups()) {
                                    int index = g.getIndex() + 1;
                                    Components.sort(box.getItems(), index, index + g.getItemCount(), cmpr);
                                }
                    Severity: Minor
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 1 other location - About 55 mins to fix
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 451..457

                    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

                                            } else {
                                                Component cc = cell.getFirstChild();
                                                if (cc instanceof Label) {
                                                    String val = ((Label) cc).getValue();
                                                    group = new Listgroup(val);
                    Severity: Minor
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 1 other location - About 50 mins to fix
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 543..551

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

                        public void setSortAscending(String clsnm)
                                throws ClassNotFoundException, InstantiationException, IllegalAccessException {
                            if (!Strings.isBlank(clsnm) && clsnm.startsWith("client") && !_sortAscNm.equals(clsnm)) {
                                _sortAscNm = clsnm;
                                smartUpdate("sortAscending", clsnm);
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 5 other locations - About 50 mins to fix
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 269..276
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 312..319
                    zul/src/main/java/org/zkoss/zul/Listheader.java on lines 333..340
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 249..256
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 287..294

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

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

                        public void setSortDescending(String clsnm)
                                throws ClassNotFoundException, InstantiationException, IllegalAccessException {
                            if (!Strings.isBlank(clsnm) && clsnm.startsWith("client") && !_sortDscNm.equals(clsnm)) {
                                _sortDscNm = clsnm;
                                smartUpdate("sortDescending", clsnm);
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 5 other locations - About 50 mins to fix
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 269..276
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 312..319
                    zul/src/main/java/org/zkoss/zul/Listheader.java on lines 290..297
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 249..256
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 287..294

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

                    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

                        public boolean sort(boolean ascending) {
                            final String dir = getSortDirection();
                            if (ascending) {
                                if ("ascending".equals(dir))
                                    return false;
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 2 other locations - About 40 mins to fix
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 362..373
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 369..379

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

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

                        public int getColumnIndex() {
                            int j = 0;
                            for (Iterator it = getParent().getChildren().iterator(); it.hasNext(); ++j)
                                if (it.next() == this)
                                    break;
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 6 other locations - About 35 mins to fix
                    zul/src/main/java/org/zkoss/zul/Footer.java on lines 57..63
                    zul/src/main/java/org/zkoss/zul/Listcell.java on lines 86..92
                    zul/src/main/java/org/zkoss/zul/Listfooter.java on lines 58..64
                    zul/src/main/java/org/zkoss/zul/Treecell.java on lines 77..83
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 333..339
                    zul/src/main/java/org/zkoss/zul/Treefooter.java on lines 58..64

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

                    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 setMaxlength(int maxlength) {
                            if (maxlength < 0)
                                maxlength = 0;
                            if (_maxlength != maxlength) {
                                _maxlength = maxlength;
                    Severity: Major
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 6 other locations - About 35 mins to fix
                    zul/src/main/java/org/zkoss/zul/Listbox.java on lines 789..796
                    zul/src/main/java/org/zkoss/zul/Panel.java on lines 317..324
                    zul/src/main/java/org/zkoss/zul/Panel.java on lines 341..348
                    zul/src/main/java/org/zkoss/zul/Treecol.java on lines 322..329
                    zul/src/main/java/org/zkoss/zul/Window.java on lines 298..305
                    zul/src/main/java/org/zkoss/zul/Window.java on lines 322..329

                    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

                                if (model != null) { //live data
                                    if (!(model instanceof GroupsSortableModel))
                                        throw new UiException(
                                                GroupsSortableModel.class + " must be implemented in " + model.getClass().getName());
                                    groupGroupsModel((GroupsSortableModel) model, cmpr, ascending, index);
                    Severity: Minor
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 1 other location - About 35 mins to fix
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 504..509

                    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

                        static {
                            addClientEvent(Listheader.class, Events.ON_SORT, CE_DUPLICATE_IGNORE);
                            addClientEvent(Listheader.class, Events.ON_GROUP, CE_DUPLICATE_IGNORE);
                            addClientEvent(Listheader.class, Events.ON_UNGROUP, CE_DUPLICATE_IGNORE);
                        }
                    Severity: Minor
                    Found in zul/src/main/java/org/zkoss/zul/Listheader.java and 1 other location - About 30 mins to fix
                    zul/src/main/java/org/zkoss/zul/Column.java on lines 70..74

                    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