Showing 4,841 of 7,782 total issues

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

    public void onAfterRender() {
        if (inPagingMold() && _model instanceof Pageable) {
            Pageable m = (Pageable) _model;
            if (m.getPageSize() > 0) { //min page size is 1
                _pgi.setPageSize(m.getPageSize());
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

Avoid deeply nested control flow statements.
Open

                        if (cols != null) {
                            for (Component treecol : cols.getChildren()) {
                                ((Treecol) treecol).setSortDirection("natural");
                            }
                        }
Severity: Major
Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

    Method service has a Cognitive Complexity of 8 (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/Panel.java - About 45 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    Avoid deeply nested control flow statements.
    Open

                            if (m.getActivePage() < 0) { //check for invalid value, min page index is 0
                                m.setActivePage(_pgi.getActivePage());
                            }
    Severity: Major
    Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

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

              public void onEvent(Event event) throws Exception {
                  if (_modelInitListener != null) {
                      Tree.this.removeEventListener("onInitModel", _modelInitListener);
                      _modelInitListener = null;
                  }
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      Avoid deeply nested control flow statements.
      Open

                                  if (i >= end) {
                                      if (sortedIndex.isEmpty()) {
                                          break;
                                      } else {
                                          start = sortedIndex.removeFirst() * size;
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

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

            public void setActivePage(Treeitem item) {
                if (item.isRealVisible() && item.getTree() == this && isVisible()) {
                    int index = getVisibleIndexOfItem(item);
                    if (index != -1) {
                        final Paginal pgi = getPaginal();
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Tree.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 addItemToSelection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public void addItemToSelection(Treeitem item) {
                if (item.getTree() != this)
                    throw new UiException("Not a child: " + item);
        
                if (!item.isSelected()) {
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Tree.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 setVisible has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public boolean setVisible(boolean visible) {
                if (isVisible() != visible) {
                    final Rows rows = (Rows) getParent();
                    if (rows != null) {
                        final Group g = rows.getGroup(getIndex());
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Row.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 fixClone has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private void fixClone() {
                if (_sortAsc instanceof ListitemComparator) {
                    final ListitemComparator c = (ListitemComparator) _sortAsc;
                    if (c.getListheader() == this && c.isAscending())
                        _sortAsc = new ListitemComparator(this, true, c.shallIgnoreCase());
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Listheader.java - About 45 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

        Avoid deeply nested control flow statements.
        Open

                                    if (i < start) {
                                        i++;
                                        continue;
                                    }
        Severity: Major
        Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

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

              protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException {
                  super.renderProperties(renderer);
          
                  String realformat = getRealFormat();
                  if (realformat.indexOf("z") != -1) {
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/Timebox.java - About 45 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Avoid deeply nested control flow statements.
          Open

                                  if (data[1] < data[2]) {
                                      // count the rendered item
                                      data[4]++;
                                      map.put(item, Boolean.TRUE);
                                  }
          Severity: Major
          Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if (!ti.isOpen() && ti.getDesktop() != null) {
                                            ti.getChildren().clear();
                                            ti.setRendered(false);
                                            ti.setLoaded(false);
                                        }
            Severity: Major
            Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

              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

              Avoid deeply nested control flow statements.
              Open

                                          if (matcher.find()) {
                                              regexFlags = matcher.group(0).trim();
                                          }
              Severity: Major
              Found in zul/src/main/java/org/zkoss/zul/SimpleConstraint.java - About 45 mins to fix

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

                    public boolean removeAll(Collection<?> c) {
                        if (_set == c || this == c) { //special case
                            clear();
                            return true;
                        }
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/ListModelSet.java - About 45 mins to fix

                Cognitive Complexity

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

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

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

                Further reading

                Avoid deeply nested control flow statements.
                Open

                                        if (_open)
                                            gmodel.addOpenGroup(gindex);
                                        else
                                            gmodel.removeOpenGroup(gindex);
                Severity: Major
                Found in zul/src/main/java/org/zkoss/zul/Group.java - About 45 mins to fix

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

                      public void setLocalized(boolean localized) {
                          if (_localized != localized) {
                              if (localized && "instant".equals(_mode))
                                  throw new UnsupportedOperationException("localized not supported in instant mode yet");
                  
                  
                  Severity: Minor
                  Found in zul/src/main/java/org/zkoss/zul/Include.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 close has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public void close() {
                          if (_selected) {
                              final Tab tab = selectNextTab();
                              if (tab != null) {
                                  final Set<Tab> selItems = new HashSet<Tab>(2);
                  Severity: Minor
                  Found in zul/src/main/java/org/zkoss/zul/Tab.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

                  Severity
                  Category
                  Status
                  Source
                  Language