Showing 7,775 of 7,775 total issues

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

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

    protected long getLastModified(HttpServletRequest request) {
        final String pi = Https.getThisPathInfo(request);
        if (pi != null && pi.startsWith(ClassWebResource.PATH_PREFIX) && pi.indexOf('*') < 0 //language independent
                && !Servlets.isIncluded(request)) {
            //If a resource extension is registered for the extension, we assume the content is dynamic
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/au/http/DHtmlResourceServlet.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(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 getLastModified has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected long getLastModified(HttpServletRequest request) {
            final String pi = Https.getThisPathInfo(request);
            if (pi != null && pi.startsWith(ClassWebResource.PATH_PREFIX) && pi.indexOf('*') < 0 //language independent
                    && !Servlets.isIncluded(request)) {
                //If a resource extension is registered for the extension,
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/au/http/DHtmlUpdateServlet.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 finishUpdate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public JSONArray finishUpdate(Object ctx, List<Throwable> errs) throws IOException {
            final UpdateInfo ui = (UpdateInfo) ctx;
            final Execution exec = ui.uv.getExecution();
            final Desktop desktop = exec.getDesktop();
    
    
    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

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

          public List<Object> getEncodedData() {
              if (_data == null)
                  return null;
      
              final JSONArray encdata = new JSONArray();
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/au/AuResponse.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 (formLegacyBean instanceof FormLegacyExt) {
                                  ((FormLegacyExt) formLegacyBean).addSaveFieldName(fieldName);
                              }
      Severity: Major
      Found in zkbind/src/main/java/org/zkoss/bind/xel/zel/BindExpressionBuilder.java - About 45 mins to fix

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

            public String toString() {
                //Don't call getCommand and getData since it causes
                //AuSetDeferredAttribute to evaluate the deferred value
                final StringBuffer sb = new StringBuffer(60).append("[cmd=").append(_cmd);
                if (_data != null && _data.length > 0) {
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/au/AuResponse.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 coerce has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private static final Integer coerce(Object property) {
                //should only handle a property that is possible a number
                if (property instanceof Number) {
                    return ((Number) property).intValue();
                }
        Severity: Minor
        Found in zkbind/src/main/java/org/zkoss/bind/xel/zel/ListModelELResolver.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 (_log.isDebugEnabled()) {
                                    _log.debug("add save-field '{}' to form '{}'", fieldName, formLegacyBean);
                                }
        Severity: Major
        Found in zkbind/src/main/java/org/zkoss/bind/xel/zel/BindExpressionBuilder.java - About 45 mins to fix

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

              /* package */static void cacheSavePropertyBinding(ProxyNode node, String property, SavePropertyBinding savePropertyBinding) {
                  while (node != null) {
                      ProxyNode parent = node.getParent();
                      if (parent == null) {
                          node.getCachedSavePropertyBinding().add(new Pair<>(property, savePropertyBinding));
          Severity: Minor
          Found in zkbind/src/main/java/org/zkoss/bind/proxy/ProxyHelper.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 (value instanceof FormProxyObject) {
                                          ((FormProxyObject) value).submitToOrigin((BindContext) args[0]);
                                      }
          Severity: Major
          Found in zkbind/src/main/java/org/zkoss/bind/proxy/BeanProxyHandler.java - About 45 mins to fix

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

                public static final String add(String zslang, String ipcls) {
                    if (zslang == null || zslang.length() == 0 || ipcls == null || ipcls.length() == 0)
                        throw new IllegalArgumentException("emty or null");
            
                    for (int j = zslang.length(); --j >= 0;) {
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/scripting/Interpreters.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 getValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    public Object getValue(ELContext context, Object property, int numOfKids) {
                        String[] msgs = null;
                        if (property instanceof Component) {
                            context.setPropertyResolved(true);
                            if (numOfKids == 0) { //case vmsgs.texts[tb1]

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

                private void saveEqualBeans(ELContext elCtx, Object base, String prop, Object value) {
                    final BindELContext ctx = (BindELContext) ((EvaluationContext) elCtx).getELContext();
            
                    final BindContext bctx = (BindContext) ctx.getAttribute(BinderImpl.BINDCTX);
            
            
            Severity: Minor
            Found in zkbind/src/main/java/org/zkoss/bind/xel/zel/BindELResolver.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 (_dirtyFieldNames != null && _dirtyFieldNames.contains(me.getKey())) {
                                            final String setter = ProxyHelper.toSetter(me.getKey());
                                            try {
                                                final Method m = Classes.getMethodByObject(_origin.getClass(), setter,
                                                        new Object[] { value });
            Severity: Major
            Found in zkbind/src/main/java/org/zkoss/bind/proxy/BeanProxyHandler.java - About 45 mins to fix
              Severity
              Category
              Status
              Source
              Language