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

Summary

Maintainability
F
1 wk
Test Coverage

File Column.java has 509 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* Column.java

    Purpose:
        
    Description:
Severity: Major
Found in zul/src/main/java/org/zkoss/zul/Column.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/Column.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 37 (exceeds 5 allowed). Consider refactoring.
    Open

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

    Column has 35 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class Column extends HeaderElement {
        private String _sortDir = "natural";
        private transient Comparator<?> _sortAsc, _sortDsc;
        private String _sortAscNm = "none";
        private String _sortDscNm = "none";
    Severity: Minor
    Found in zul/src/main/java/org/zkoss/zul/Column.java - About 4 hrs to fix

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

          public void ungroup(boolean ascending) {
              final Comparator<?> cmpr = ascending ? _sortAsc : _sortDsc;
              if (cmpr != null) {
      
                  final Grid grid = getGrid();
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Column.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 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 RowComparator) {
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Column.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 76 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/Column.java - About 3 hrs to fix

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

            /*package*/ 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/Column.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 setSort has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public void setSort(String type) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
                if (type == null)
                    return;
                if (type.startsWith("client")) {
                    setSortAscending(type);
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Column.java - About 1 hr to fix

          Method writeObject has 39 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 RowComparator) {
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/Column.java - About 1 hr to fix

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

                /*package*/ 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/Column.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/Column.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 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Avoid deeply nested control flow statements.
                Open

                                            for (Group group : new ArrayList<Group>(rows.getGroups()))
                                                group.detach(); // Groupfoot is removed
                Severity: Major
                Found in zul/src/main/java/org/zkoss/zul/Column.java - About 45 mins to fix

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

                      private void fixClone() {
                          if (_sortAsc instanceof RowComparator) {
                              final RowComparator c = (RowComparator) _sortAsc;
                              if (c.getColumn() == this && c.isAscending())
                                  _sortAsc = new RowComparator(this, true, c.shallIgnoreCase(), false);
                  Severity: Minor
                  Found in zul/src/main/java/org/zkoss/zul/Column.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 grid with null group        
                  Severity: Major
                  Found in zul/src/main/java/org/zkoss/zul/Column.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/Column.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/Column.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/Column.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 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/Column.java and 1 other location - About 2 hrs to fix
                      zul/src/main/java/org/zkoss/zul/Listheader.java on lines 726..745

                      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

                      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/Column.java and 2 other locations - About 2 hrs to fix
                      zul/src/main/java/org/zkoss/zul/Listheader.java on lines 149..163
                      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 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/Column.java and 2 other locations - About 1 hr to fix
                      zul/src/main/java/org/zkoss/zul/Listheader.java on lines 342..354
                      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/Column.java and 5 other locations - About 1 hr to fix
                      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/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/Column.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/Listheader.java on lines 275..285
                      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 2 locations. Consider refactoring.
                      Open

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

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

                      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 Group(val);
                      Severity: Minor
                      Found in zul/src/main/java/org/zkoss/zul/Column.java and 1 other location - About 50 mins to fix
                      zul/src/main/java/org/zkoss/zul/Listheader.java on lines 573..581

                      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 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/Column.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/Listheader.java on lines 290..297
                      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 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/Column.java and 5 other locations - About 50 mins to fix
                      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/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

                      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/Column.java and 2 other locations - About 40 mins to fix
                      zul/src/main/java/org/zkoss/zul/Listheader.java on lines 414..424
                      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 2 locations. Consider refactoring.
                      Open

                              if (b) {
                                  final boolean igcs = s.readBoolean();
                                  _sortAsc = new RowComparator(this, true, igcs, false);
                              } else {
                                  //bug #2830325 FieldComparator not castable to ListItemComparator
                      Severity: Minor
                      Found in zul/src/main/java/org/zkoss/zul/Column.java and 1 other location - About 35 mins to fix
                      zul/src/main/java/org/zkoss/zul/Column.java on lines 810..816

                      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 (b) {
                                  final boolean igcs = s.readBoolean();
                                  _sortDsc = new RowComparator(this, false, igcs, false);
                              } else {
                                  //bug #2830325 FieldComparator not castable to ListItemComparator
                      Severity: Minor
                      Found in zul/src/main/java/org/zkoss/zul/Column.java and 1 other location - About 35 mins to fix
                      zul/src/main/java/org/zkoss/zul/Column.java on lines 801..807

                      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/Column.java and 1 other location - About 35 mins to fix
                      zul/src/main/java/org/zkoss/zul/Listheader.java on lines 537..542

                      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(Column.class, Events.ON_SORT, CE_DUPLICATE_IGNORE);
                              addClientEvent(Column.class, Events.ON_GROUP, CE_DUPLICATE_IGNORE);
                              addClientEvent(Column.class, Events.ON_UNGROUP, CE_DUPLICATE_IGNORE);
                          }
                      Severity: Minor
                      Found in zul/src/main/java/org/zkoss/zul/Column.java and 1 other location - About 30 mins to fix
                      zul/src/main/java/org/zkoss/zul/Listheader.java on lines 72..76

                      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