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

Summary

Maintainability
F
1 wk
Test Coverage

Method initDataListener has a Cognitive Complexity of 114 (exceeds 5 allowed). Consider refactoring.
Open

    private void initDataListener() {
        if (INVALIDATE_THRESHOLD == -1) {
            INVALIDATE_THRESHOLD = Utils.getIntAttribute(this, "org.zkoss.zul.invalidateThreshold", 10, true);
        }
        if (_dataListener == null)
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 2 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File Combobox.java has 855 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* Combobox.java

    Purpose:

    Description:
Severity: Major
Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 2 days to fix

    Combobox has 91 methods (exceeds 20 allowed). Consider refactoring.
    Open

    @SuppressWarnings("serial")
    public class Combobox extends Textbox {
        public static final String ICON_SCLASS = "z-icon-caret-down";
    
        private static final Logger log = LoggerFactory.getLogger(Combobox.class);
    Severity: Major
    Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 1 day to fix

      Method onChange has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
      Open

                      public void onChange(ListDataEvent event) {
                          int type = event.getType();
                          if (getAttribute(Attributes.BEFORE_MODEL_ITEMS_RENDERED) != null
                                  && (type == ListDataEvent.INTERVAL_ADDED || type == ListDataEvent.INTERVAL_REMOVED))
                              return;
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 1 day to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method initDataListener has 118 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private void initDataListener() {
              if (INVALIDATE_THRESHOLD == -1) {
                  INVALIDATE_THRESHOLD = Utils.getIntAttribute(this, "org.zkoss.zul.invalidateThreshold", 10, true);
              }
              if (_dataListener == null)
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 4 hrs to fix

        Method setModel has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            public void setModel(ListModel<?> model) {
                if (model != null) {
                    if (!(model instanceof Selectable))
                        throw new UiException(model.getClass() + " must implement " + Selectable.class);
        
        
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Combobox.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 service has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public void service(org.zkoss.zk.au.AuRequest request, boolean everError) {
                final String cmd = request.getCommand();
                if (cmd.equals(Events.ON_OPEN)) {
                    OpenEvent evt = OpenEvent.getOpenEvent(request);
                    _open = evt.isOpen();
        Severity: Major
        Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 2 hrs to fix

          Method service has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public void service(org.zkoss.zk.au.AuRequest request, boolean everError) {
                  final String cmd = request.getCommand();
                  if (cmd.equals(Events.ON_OPEN)) {
                      OpenEvent evt = OpenEvent.getOpenEvent(request);
                      _open = evt.isOpen();
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/Combobox.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 render has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public void render(final Comboitem item, final Object data, final int index) {
                      final Combobox cb = (Combobox) item.getParent();
                      final Template tm = cb.getTemplate("model");
                      if (tm == null) {
                          item.setLabel(Objects.toString(data));
          Severity: Major
          Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 2 hrs to fix

            Method doSelectionChanged has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                private void doSelectionChanged() {
                    final Selectable<Object> smodel = getSelectableModel();
                    if (smodel.isSelectionEmpty()) {
                        if (_selItem != null)
                            setSelectedItem(null);
            Severity: Minor
            Found in zul/src/main/java/org/zkoss/zul/Combobox.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 setModel has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public void setModel(ListModel<?> model) {
                    if (model != null) {
                        if (!(model instanceof Selectable))
                            throw new UiException(model.getClass() + " must implement " + Selectable.class);
            
            
            Severity: Minor
            Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 1 hr to fix

              Method setSelectedItem has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public void setSelectedItem(Comboitem item) {
                      if (item != null && item.getParent() != this)
                          throw new UiException("Not a child: " + item);
              
                      if (item != _selItem) {
              Severity: Minor
              Found in zul/src/main/java/org/zkoss/zul/Combobox.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 render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      @SuppressWarnings("unchecked")
                      private void render(Comboitem item, Object value, int index) throws Throwable {
                          if (!_rendered && (_renderer instanceof RendererCtrl)) {
                              ((RendererCtrl) _renderer).doTry();
                              _ctrled = true;
              Severity: Minor
              Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 1 hr to fix

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

                        @SuppressWarnings("unchecked")
                        private void render(Comboitem item, Object value, int index) throws Throwable {
                            if (!_rendered && (_renderer instanceof RendererCtrl)) {
                                ((RendererCtrl) _renderer).doTry();
                                _ctrled = true;
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 55 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 onInitRender has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    @SuppressWarnings("rawtypes")
                    public void onInitRender(Event data) {
                        //Bug #2010389
                        removeAttribute(ATTR_ON_INIT_RENDER); //clear syncModel flag
                        final Renderer renderer = new Renderer();
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 55 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 renderProperties has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException {
                        super.renderProperties(renderer);
                
                        render(renderer, "autodrop", _autodrop);
                        if (!_autocomplete)
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 55 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 coerceToString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected String coerceToString(Object value) {
                        final Constraint constr = getConstraint();
                        final String val = super.coerceToString(value);
                        if (val.length() > 0 && constr != null && constr instanceof SimpleConstraint
                                && (((SimpleConstraint) constr).getFlags() & SimpleConstraint.STRICT) != 0) {
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 45 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method clone has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    @SuppressWarnings("rawtypes")
                    public Object clone() {
                        final Combobox clone = (Combobox) super.clone();
                        clone._selItem = null;
                        clone.schedSyncValueToSelection();
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

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

                    private void syncValueToSelection() {
                        final String value = getValue();
                        if (!Objects.equals(_lastCkVal, value)) {
                            _lastCkVal = value;
                            _selItem = null;
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Combobox.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();
                
                        schedSyncValueToSelection();
                        if (_model != null) {
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Combobox.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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                        public void render(final Comboitem item, final Object data, final int index) {
                            final Combobox cb = (Combobox) item.getParent();
                            final Template tm = cb.getTemplate("model");
                            if (tm == null) {
                                item.setLabel(Objects.toString(data));
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Combobox.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

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

                    @SuppressWarnings("rawtypes")
                    private static final ComboitemRenderer _defRend = new ComboitemRenderer() {
                        public void render(final Comboitem item, final Object data, final int index) {
                            final Combobox cb = (Combobox) item.getParent();
                            final Template tm = cb.getTemplate("model");
                Severity: Major
                Found in zul/src/main/java/org/zkoss/zul/Combobox.java and 1 other location - About 4 hrs to fix
                zul/src/main/java/org/zkoss/zul/Radiogroup.java on lines 607..680

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

                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

                    static {
                        _properties.put("buttonVisible", new BooleanPropertyAccess() {
                            public void setValue(Component cmp, Boolean value) {
                                ((Combobox) cmp).setButtonVisible(value);
                            }
                Severity: Major
                Found in zul/src/main/java/org/zkoss/zul/Combobox.java and 2 other locations - About 2 hrs to fix
                zhtml/src/main/java/org/zkoss/zhtml/impl/AbstractTag.java on lines 585..622
                zk/src/main/java/org/zkoss/zk/ui/HtmlNativeComponent.java on lines 417..456

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

                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

                            try {
                                try {
                                    _renderer.render(item, value, index);
                                } catch (AbstractMethodError ex) {
                                    final Method m = _renderer.getClass().getMethod("render",
                Severity: Major
                Found in zul/src/main/java/org/zkoss/zul/Combobox.java and 1 other location - About 1 hr to fix
                zul/src/main/java/org/zkoss/zul/Listbox.java on lines 2760..2772

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

                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 class ExtraCtrl extends Textbox.ExtraCtrl implements Blockable {
                        public boolean shallBlock(AuRequest request) {
                            // B50-3316103: special case of readonly component: do not block onChange and onSelect
                            final String cmd = request.getCommand();
                            if (Events.ON_OPEN.equals(cmd))
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Combobox.java and 1 other location - About 50 mins to fix
                zul/src/main/java/org/zkoss/zul/Datebox.java on lines 874..883

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 62.

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

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

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

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

                Refactorings

                Further Reading

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

                                            if (_model == null || items.size() < 1)
                                                return null;
                                            else {
                                                Set<Object> s = new LinkedHashSet<Object>();
                                                s.add(_model.getElementAt(((Comboitem) items.iterator().next()).getIndex()));
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Combobox.java and 1 other location - About 50 mins to fix
                zul/src/main/java/org/zkoss/zul/Tab.java on lines 435..441

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

                    public void onPageAttached(Page newpage, Page oldpage) {
                        super.onPageAttached(newpage, oldpage);
                        if (_model != null) {
                            postOnInitRender(null);
                            if (_dataListener != null) {
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Combobox.java and 1 other location - About 45 mins to fix
                zul/src/main/java/org/zkoss/zul/Radiogroup.java on lines 773..782

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

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

                        private void doCatch(Throwable ex) {
                            if (_ctrled) {
                                try {
                                    ((RendererCtrl) _renderer).doCatch(ex);
                                } catch (Throwable t) {
                Severity: Major
                Found in zul/src/main/java/org/zkoss/zul/Combobox.java and 4 other locations - About 40 mins to fix
                zul/src/main/java/org/zkoss/zul/Grid.java on lines 1224..1234
                zul/src/main/java/org/zkoss/zul/Listbox.java on lines 2798..2808
                zul/src/main/java/org/zkoss/zul/Radiogroup.java on lines 712..722
                zul/src/main/java/org/zkoss/zul/Tree.java on lines 2394..2404

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

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

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

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

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

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 44.

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

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

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

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

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 40.

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

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

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

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

                Refactorings

                Further Reading

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

                                            for (int i = max + 1, j = comboitems.size(); i < j && iterator.hasNext(); start++) {
                                                if (start < i) {
                                                    iterator.next();
                                                    continue;
                                                }
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Combobox.java and 1 other location - About 30 mins to fix
                zul/src/main/java/org/zkoss/zul/Combobox.java on lines 347..353

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 40.

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

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

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

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

                Refactorings

                Further Reading

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

                                                 i < j && iterator.hasNext(); start++) {
                                                if (start < i) {
                                                    iterator.next();
                                                    continue;
                                                }
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Combobox.java and 1 other location - About 30 mins to fix
                zul/src/main/java/org/zkoss/zul/Combobox.java on lines 301..307

                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