Showing 4,841 of 7,782 total issues

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

    private void outErrReloads(RequestContext reqctx, Configuration config, StringBuffer sb, Object[][] infs) {
        for (int j = 0; j < infs.length; ++j) {
            if (j > 0)
                sb.append(',');
            sb.append('\'').append(infs[j][0]).append("':'");
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/http/WpdExtendlet.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 encodeURL has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public String encodeURL(String uri) {
        if (uri == null || uri.isEmpty()) // ZK-5598
            return uri;
        try {
            String encodedURL = Encodes.encodeURL(_ctx, _request, _response, uri);
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/http/ExecutionImpl.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

                                for (EventListener<? extends Event> listener : listeners)
                                    if (listener instanceof ComposerEventListener)
                                        c.removeEventListener(name, listener);
Severity: Major
Found in zk/src/main/java/org/zkoss/zk/ui/select/Selectors.java - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            for (int k = j += 7; k < len; ++k) {
                                if (sb.charAt(k) == '>') {
                                    if (shallFilter(sb.substring(j, k)))
                                        return sb.substring(k + 1);
                                    break;
    Severity: Major
    Found in zk/src/main/java/org/zkoss/zk/ui/http/DHtmlLayoutFilter.java - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if (t != null)
                                  return t;
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/Templates.java - About 45 mins to fix

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

            private String findResourcePath(RequestContext reqctx, OutputStream out, String path, String dir, boolean locate, boolean write) throws ServletException, IOException {
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/http/WpdExtendlet.java - About 45 mins to fix

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

                  private Object parse(RequestContext reqctx) throws ServletException, IOException {
                      if (_cnt instanceof SourceInfo)
                          try {
                              _cnt = ((SourceInfo) _cnt).parse(reqctx);
                          } catch (IOException ex) {
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/http/WpdExtendlet.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 handleError has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              private void handleError(Session sess, RenderRequest request, RenderResponse response, String path, Throwable err,
                      String msg) throws PortletException, IOException {
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/http/DHtmlLayoutPortlet.java - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                            if (tmp != null) {
                                                if (template == null) {
                                                    // Bug ZK-2855: only assign first match, all following matches will be discarded
                                                    template = tmp;
                                                }
            Severity: Major
            Found in zk/src/main/java/org/zkoss/zk/ui/Templates.java - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (!isDescendant(rt2, rt))
                                          return null;
              Severity: Major
              Found in zk/src/main/java/org/zkoss/zk/ui/select/impl/ComponentIterator.java - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (rt2.getPreviousSibling() != rt)
                                            return null;
                Severity: Major
                Found in zk/src/main/java/org/zkoss/zk/ui/select/impl/ComponentIterator.java - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (parentCtrl.getShadowRoots().contains(comp)) {
                                              return true;
                                          }

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

                        public static Class<?> getClass(Type type) {
                            if (type instanceof Class<?>)
                                return (Class<?>) type;
                    
                            else if (type instanceof ParameterizedType)
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/select/impl/Reflections.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 (rt2 instanceof ShadowElement) {
                                                if (((ShadowElement) rt2).getShadowHost() != rt)
                                                    return null;
                                            } else if (rt2.getParent() != rt) {
                                                return null;
                    Severity: Major
                    Found in zk/src/main/java/org/zkoss/zk/ui/select/impl/ComponentIterator.java - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if (!isGeneralSibling(rt2, rt))
                                                  return null;
                      Severity: Major
                      Found in zk/src/main/java/org/zkoss/zk/ui/select/impl/ComponentIterator.java - About 45 mins to fix

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

                            /*package*/ static boolean matchClasses(Component component, Set<String> classes) {
                                if (classes == null || classes.isEmpty())
                                    return true;
                        
                                if (!(component instanceof HtmlBasedComponent))

                        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 getValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private static Object getValue(Component component, String name) {
                                try {
                                    return component.getClass().getMethod("get" + capitalize(name)).invoke(component);
                                } catch (NoSuchMethodException e) {
                                    // no such method

                        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 getObjectByName has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                                private Object getObjectByName(PsdoCompFunctor functor, String name, Class<?> type,
                                        List<VariableResolver> resolvers) {
                        
                                    Object result = functor.getXelVariable(name);
                                    if (isValidValue(result, type))
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/select/Selectors.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 addExtension has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static final void addExtension(String ext, String lang) {
                                if (_loaded) {
                                    LanguageDefinition.addExtension(ext, lang);
                                } else {
                                    if (lang == null || ext == null)
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.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 (n != null && !withEL(n)) {
                                                    int k = n.lastIndexOf('.');
                                                    cssURI = "~." + device.toAbsolutePath(n.substring(0, k).replace('.', '/') + '/' + cssURI);
                                                } else {
                                                    if (n == null) {
                        Severity: Major
                        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language