Showing 4,841 of 7,782 total issues

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

    public void addRequests(Collection<AuRequest> requests) {
        for (AuRequest request : requests) {
            try {
                request.activate();
                if (!isObsolete(request))
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/impl/RequestQueueImpl.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 (ls.size() == 1)
                            _listeners.remove(evtnm);
                        else
                            it.remove();
Severity: Major
Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java - About 45 mins to fix

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

        public boolean enableServerPush(ServerPush serverpush) {
            final boolean serverPushAlreadyExists = _spush != null, enable = serverpush != null;
            if (serverPushAlreadyExists != enable || serverpush != _spush) {
                if (serverPushAlreadyExists)
                    enableServerPush(false, null);
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/impl/DesktopImpl.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 doBeforeCompose has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public ComponentInfo doBeforeCompose(Page page, Component parent, ComponentInfo compInfo) throws Exception {
            for (int j = 0; j < _cs.length; ++j)
                if (_cs[j] instanceof ComposerExt && shallInvoke(_cs[j])) {
                    compInfo = ((ComposerExt) _cs[j]).doBeforeCompose(page, parent, compInfo);
                    if (compInfo == null)
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/impl/MultiComposer.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 newComposer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public static Composer newComposer(Page page, Object o) throws Exception {
            Class cls;
            if (o instanceof String) {
                final String clsnm = ((String) o).trim();
                if (page != null)
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/impl/Utils.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 desktopDestroyed has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private static void desktopDestroyed(Desktop desktop) {
            final Session sess = desktop.getSession();
            final Execution exec = new ExecutionImpl(desktop.getWebApp().getServletContext(), null, null, desktop, null);
            final DesktopCtrl desktopCtrl = (DesktopCtrl) desktop;
            final Execution oldExec = desktop.getExecution();
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/impl/SimpleDesktopCache.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 compareTo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            public int compareTo(Object o) {
                final TimedValue tv = (TimedValue) o;
                return _priority == tv._priority ? _timed > tv._timed ? 1 : _timed == tv._timed ? 0 : -1
                        : _priority > tv._priority ? -1 : 1; //higher priority, earlier (smaller)
            }
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.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 (add)
                                exec.addResponseHeader(nm, (Date) val);
                            else
                                exec.setResponseHeader(nm, (Date) val);
    Severity: Major
    Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java - About 45 mins to fix

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

          public boolean doCatch(Throwable ex) throws Exception {
              for (int j = 0; j < _cs.length; ++j)
                  if (_cs[j] instanceof ComposerExt && shallInvoke(_cs[j]))
                      if (((ComposerExt) _cs[j]).doCatch(ex))
                          return true; //caught (eat it)
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/impl/MultiComposer.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 (Events.isListened(root, Events.ON_PIGGYBACK, false)) { //asap+deferrable
                                  Events.postEvent(new Event(Events.ON_PIGGYBACK, root));
                                  Executions.getCurrent().setAttribute(ATTR_PIGGYBACK_POSTED, Boolean.TRUE);
                              }
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/impl/DesktopImpl.java - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if (ck != null && ck.getParent() == parent) {
                                    newsibs.add(ck);
                                    attached[k] = null;
                                }
        Severity: Major
        Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 45 mins to fix

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

              private static Object reconstructPacket(Object data, Map<String, Object> reqData, Desktop desktop,
                      Map<String, Object> params) throws IOException {
                  if (data instanceof List) {
                      int i = 0;
                      List listData = (List) data;
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/au/http/AuMultipartUploader.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 ceaseSuspendedThread has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public boolean ceaseSuspendedThread(Desktop desktop, EventProcessingThread evtthd, String cause) {
                  final Map<Object, List<EventProcessingThreadImpl>> map;
                  synchronized (_suspended) {
                      map = _suspended.get(desktop);
                  }
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiEngineImpl.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 getDestroyTimeout has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private static final int getDestroyTimeout() {
                  if (_destroyTimeout == null) {
                      int v = 0;
                      final String s = Library.getProperty("org.zkoss.zk.ui.activate.wait.destroy.timeout");
                      if (s != null) {
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiEngineImpl.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 createComponentsDirectly0 has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              private Component createComponentsDirectly0(String content, String ext, Component parent, Component insertBefore,
                      VariableResolver resolver, Map<?, ?> arg) {
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/impl/AbstractExecution.java - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (isEffective(childInfo, page, parent)) {
                                        final Component[] children = execCreateChild(ci, parent, childInfo, replaceableText,
                                                insertBefore);
                                        Collections.addAll(created, children);
                                    }
            Severity: Major
            Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiEngineImpl.java - About 45 mins to fix

              Method createComponentsDirectly0 has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  private Component createComponentsDirectly0(Document content, String ext, Component parent, Component insertBefore,
                          VariableResolver resolver, Map<?, ?> arg) {
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/impl/AbstractExecution.java - About 45 mins to fix

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

                    private static final String setServerPushClass0(String deviceType, Object cls) {
                        if (deviceType == null || deviceType.length() == 0)
                            throw new IllegalArgumentException();
                
                        try {
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/device/Devices.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 createComponentsDirectly0 has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    private Component createComponentsDirectly0(Reader reader, String ext, Component parent, Component insertBefore,
                            VariableResolver resolver, Map<?, ?> arg) throws IOException {
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/impl/AbstractExecution.java - About 45 mins to fix

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

                      public static boolean setCacheControl(ServletContext context, HttpServletRequest request,
                              HttpServletResponse response, String prop, int hours) {
                          if (prop == null || !"false".equals(Library.getProperty(prop))) {
                              response.setHeader("Cache-Control", "public, max-age=" + hours * 3600); //unit: seconds
                  
                  
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/fn/JspFns.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