Showing 4,841 of 7,782 total issues

Function _deconstructPacket has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        export function _deconstructPacket(data: ArrayBufferView | unknown & { buffer?} | undefined, buffers: unknown[]): unknown {
            if (!data) return data;

            if (_isBinary(data)) {
                const placeholder = { _placeholder: true, num: buffers.length };
Severity: Minor
Found in zk/src/main/resources/web/js/zk/au.ts - About 1 hr to fix

    Function _swipeEnd has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _swipeEnd(devt: JQuery.TriggeredEvent): void {
            jq(this.node).off(moveEvt, this.proxy(this._swipeMove));
            if (start && stop && this.opts) {
                var dispX: number | undefined, dispY: number | undefined,
                    dispT = stop.time - start.time, dir: 'left' | 'right' | 'up' | 'down' | undefined;
    Severity: Minor
    Found in zk/src/main/resources/web/js/zk/zswipe.ts - About 1 hr to fix

      Function snap has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function snap(dg: zk.Draggable, pointer: zk.Offset): zk.Offset {
          var x = pointer[0],
              y = pointer[1];
          if (dg._isVer) {
              var move = y;
      Severity: Minor
      Found in zul/src/main/resources/web/js/zul/WScroll.ts - About 1 hr to fix

        Function CallExpression has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    CallExpression(node) {
                        const { callee } = node;
                        if (callee.type !== AST_NODE_TYPES.MemberExpression ||
                            callee.object.type !== AST_NODE_TYPES.Identifier ||
                            callee.object.name !== 'zk' ||
        Severity: Minor
        Found in eslint-plugin-zk/src/rules/preferNativeClass.ts - About 1 hr to fix

          Function isParameter has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              isParameter: function (node: TSESTree.Node, expr: TSESTree.Node) {
          
                  if (expr.type === 'CallExpression') {
          
                      // Check whether any of the call arguments equals the node.
          Severity: Minor
          Found in eslint-plugin-zk/src/tree.ts - About 1 hr to fix

            Function AssignmentExpression has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        AssignmentExpression: function (node) {
                            const left = node.left as TSESTree.Expression & {property?: {name: string}, object: {name: string, property?: TSESTree.Identifier}};
                            // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
                            const isHref: boolean = left.property?.name === 'href';
                            if (!isHref) {
            Severity: Minor
            Found in eslint-plugin-zk/src/rules/noLocationHrefAssign.ts - About 1 hr to fix

              Method filterStyle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  private String filterStyle(String style) {
                      if (style != null) {
                          final int j = HTMLs.getSubstyleIndex(style, "display");
                          if (j >= 0) { // display is specified
                              super.setVisible(!"none".equals(HTMLs.getSubstyleValue(style, j)));
              Severity: Minor
              Found in zhtml/src/main/java/org/zkoss/zhtml/impl/AbstractTag.java - About 1 hr 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 getLocale has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static final Locale getLocale(String localeString, char separator) {
                      if (localeString == null)
                          return null;
              
                      if (separator == (char)0) {
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/util/Locales.java - About 1 hr 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 getEvaluatorClass has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  @SuppressWarnings("unchecked")
                  public static final Class<? extends ExpressionFactory> getEvaluatorClass(String name) {
                      if (name == null || name.length() == 0)
                          throw new IllegalArgumentException("empty or null");
              
              
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/xel/util/Evaluators.java - About 1 hr 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 locate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static final String locate(String flnm) {
                      int j = flnm.indexOf('*');
                      if (j < 0) return flnm;
              
                      final String postfix = flnm.substring(j + 1);
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/io/Files.java - About 1 hr 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 getOutputStream has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  private OutputStream getOutputStream() {
                      if (_out == null)
                          return _nobuf ? null: (_out = new ByteArrayOutputStream());
                              //it is possible _membufsz <= 0, but OK to use memory first
              
              
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/io/RepeatableInputStream.java - About 1 hr 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 normalize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static final String normalize(String parentPath, String childPath) {
                      if (childPath == null || childPath.length() == 0)
                          return normalize(parentPath);
                      if ((parentPath == null || parentPath.length() == 0)
                      || childPath.charAt(0) == '/')
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/io/Files.java - About 1 hr 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 getDateFormat has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static
                  String getDateFormat(int style, Locale locale, String defaultFormat) {
                      if (locale == null)
                          locale = Locales.getCurrent();
              
              
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/text/DateFormats.java - About 1 hr 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 getWriter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  private Writer getWriter() throws IOException {
                      if (_out == null)
                          return _nobuf ? null: (_out = new StringWriter());
                              //it is possible _membufsz <= 0, but OK to use memory first
              
              
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/io/RepeatableReader.java - About 1 hr 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 copyFile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static final void copyFile(File dst, File src, int flags)
                  throws IOException {
                      if (dst.equals(src))
                          throw new IOException("Copy to the same file, "+src);
              
              
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/io/Files.java - About 1 hr 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 hasContent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public final boolean hasContent(String path) {
                      Element e = this;
                      int j = 0;
                      while (true) {
                          int k = path.indexOf('/', j);
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/idom/Element.java - About 1 hr 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 getAnyMethod has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static final Method
                  getAnyMethod(Class<?> cls, String name, Class<?>[] argTypes)
                  throws NoSuchMethodException {
                      try {
                          return cls.getDeclaredMethod(name, argTypes);
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 1 hr 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 substring has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static final
                  Result substring(String src, int from, char until, boolean escBackslash) {
                      final int len = src.length();
                      final StringBuilder sb = new StringBuilder(len);
                      for (boolean quoted = false; from < len; ++from) {
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/lang/Strings.java - About 1 hr 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 equals has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                      @Override
                      public boolean equals(Object obj) {
                          if (!(obj instanceof CachedMethodInfo))
                              return false;
                          if (!((CachedMethodInfo) obj).getMethodName().equals(this._methodName))
              Severity: Minor
              Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java - About 1 hr 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 jjMoveStringLiteralDfa2_1 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              private int jjMoveStringLiteralDfa2_1(long old0, long active0)
              {
                 if (((active0 &= old0)) == 0L)
                    return jjStartNfa_1(0, old0);
                 try { curChar = input_stream.readChar(); }

              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