Showing 4,841 of 7,782 total issues

Avoid deeply nested control flow statements.
Open

                        if (k > 0) sb.append('_');
Severity: Major
Found in zcommon/src/main/java/org/zkoss/util/resource/Locators.java - About 45 mins to fix

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

        public Enumeration<URL> getResources(String name) throws IOException {
            name = resolveName(name);
    
            // no need to use Classes.getContextClassLoader() here because of the loading order issue
            ClassLoader cl = Thread.currentThread().getContextClassLoader();
    Severity: Minor
    Found in zcommon/src/main/java/org/zkoss/util/resource/ClassLocator.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 (first)
                                first = false;
                            else
                                _jsout.append(',');
    Severity: Major
    Found in zhtml/src/main/java/org/zkoss/zhtml/impl/TagRenderContext.java - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if (expend instanceof String)
                                  expended = expendValue(labels, (String) expend);
                              else if (expend instanceof ExValue)
                                  expended = expendValue(labels, ((ExValue) expend).getValue());
      Severity: Major
      Found in zcommon/src/main/java/org/zkoss/util/resource/impl/LabelLoaderImpl.java - About 45 mins to fix

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

            private static String getName(URL url) {
                String name = url.getPath();
                if (name != null) {
                    {
                        final int j = name.lastIndexOf(File.pathSeparatorChar);
        Severity: Minor
        Found in zcommon/src/main/java/org/zkoss/sound/AAudio.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 (j >= 0 && line.charAt(j) == '}') {
                                        if (j > 0)
                                            j = 1 + Strings.skipWhitespacesBackward(line, j - 1);
                                        if (j == 0) //no non-space before }
                                            break;
        Severity: Major
        Found in zcommon/src/main/java/org/zkoss/util/Maps.java - About 45 mins to fix

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

              public static final int valueOf(String name) {
                  name = name.toUpperCase();
                  if ("CEILING".equals(name)) return BigDecimal.ROUND_CEILING;
                  if ("DOWN".equals(name)) return BigDecimal.ROUND_DOWN;
                  if ("FLOOR".equals(name)) return BigDecimal.ROUND_FLOOR;
          Severity: Minor
          Found in zcommon/src/main/java/org/zkoss/math/RoundingModes.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 getName has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private String getName(URL url) {
                  String name = url.getPath();
                  if (name != null) {
                      
                      final int i = name.lastIndexOf(File.pathSeparatorChar);
          Severity: Minor
          Found in zcommon/src/main/java/org/zkoss/video/AVideo.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 parseDate has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static final Date parseDate(String source, String pattern, Locale locale, TimeZone timezone, String dateStyle, String timeStyle) throws Exception {
          Severity: Minor
          Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 45 mins to fix

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

                public static final String formatDate(Date date, String pattern, Locale locale, TimeZone timezone, String dateStyle, String timeStyle) {
            Severity: Minor
            Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 45 mins to fix

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

                  public static final boolean isAttribute(String methodName) {
                      int len = methodName.length();
                      if (len < 2)
                          return false;
              
              
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/lang/Classes.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 readObject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private void readObject(ObjectInputStream s)
                  throws IOException, ClassNotFoundException {
                      s.defaultReadObject();
              
                      final Class<?> cls = (Class<?>)s.readObject();
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/lang/reflect/SerializableMethod.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 nextToken has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static final Result nextToken(String src, int from,
                  char[] separators, boolean escBackslash, boolean quotAsToken,
                  boolean parenthesis)
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 45 mins to fix

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

                    public static final void joinAndInterrupt(Thread thd, int timeout)
                    throws InterruptedException {
                        if (timeout == 0)
                            timeout = Integer.MAX_VALUE;
                
                
                Severity: Minor
                Found in zcommon/src/main/java/org/zkoss/lang/Threads.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 escapeJavaScript has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public static void escapeJavaScript(final char[] text, final int offset, final int len, final Writer writer,
                                                        final JavaScriptEscapeType type, final JavaScriptEscapeLevel level)
                Severity: Minor
                Found in zcommon/src/main/java/org/zkoss/lang/JavaScriptEscape.java - About 45 mins to fix

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

                      public final void setNamespace(Namespace ns) {
                          if (ns == null) {
                              if (_ns != null && _ns.getPrefix().length() == 0)
                                  return; //nothing to do
                              ns = getNamespace("");
                  Severity: Minor
                  Found in zcommon/src/main/java/org/zkoss/idom/Element.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 escapeJavaScript has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static void escapeJavaScript(final char[] text, final int offset, final int len, final Writer writer,
                                                          final JavaScriptEscapeType type, final JavaScriptEscapeLevel level)
                                                          throws IOException {
                  
                          if (writer == null) {
                  Severity: Minor
                  Found in zcommon/src/main/java/org/zkoss/lang/JavaScriptEscape.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 setValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public void setValue(ELContext context, Object base, Object property,
                              Object value) {
                          if (context == null) {
                              throw new NullPointerException();
                          }
                  Severity: Minor
                  Found in zel/src/main/java/org/zkoss/zel/ArrayELResolver.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 getMessage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static final String getMessage(Throwable ex) {
                          String s;
                          for (Throwable t = ex;;) {
                              s = t.getMessage();
                              if (s != null && s.length() > 0)
                  Severity: Minor
                  Found in zcommon/src/main/java/org/zkoss/lang/Exceptions.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 ((f - (i + 2)) < 2) {
                                              // We weren't able to consume the required two hexa chars, leave it as slash+'x', which
                                              // is invalid, and let the corresponding JavaScript engine fail.
                                              i++;
                                              continue;
                  Severity: Major
                  Found in zcommon/src/main/java/org/zkoss/lang/JavaScriptEscapeUtil.java - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language