Showing 4,841 of 7,782 total issues

Method insertBefore has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public boolean insertBefore(Component newChild, Component refChild) {
        if (newChild instanceof Treecols) {
            if (super.insertBefore(newChild, refChild)) {
                _treecols = (Treecols) newChild;
                return true;
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

    Method compare has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public int compare(Object o1, Object o2) {
            if (_index < 0 && _column != null) //decide the index
                _index = _column.getParent().getChildren().indexOf(_column);
    
            Object v1, v2;
    Severity: Minor
    Found in zul/src/main/java/org/zkoss/zul/RowComparator.java - About 1 hr to fix

      Function squarify has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function squarify(node) {
          var children = node.children;
          if (children && children.length) {
            var rect = pad(node),
                row = [],
      Severity: Minor
      Found in zktest/src/main/webapp/js/d3.layout.js - About 1 hr to fix

        Function _initDocument has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            const _initDocument = function _initDocument(dirty) {
              /* Create a HTML document */
              let doc = null;
              let leadingWhitespace = null;
              if (FORCE_BODY) {
        Severity: Minor
        Found in zk/src/main/resources/web/js/zk/ext/purify.js - About 1 hr to fix

          Function handler has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  handler: function( event ) {
                      var notAsync, result,
                          saved = dataPriv.get( this, type );
          
                      if ( ( event.isTrigger & 1 ) && this[ type ] ) {
          Severity: Minor
          Found in zk/src/main/resources/web/js/zk/ext/jquery.js - About 1 hr to fix

            Function pushReqCmds has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    export function pushReqCmds(reqInf: AuRequestInfo, response: AuResponse): boolean {
                        var dt = reqInf.dt,
                            rt = response.responseText;
                        if (!rt) {
                            if (zk.pfmeter) zAu._pfdone(dt, zAu.pfGetIds(response));
            Severity: Minor
            Found in zk/src/main/resources/web/js/zk/au.ts - About 1 hr to fix

              Function onURLChange has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  onURLChange(): void { //called by mount.js
                      try {
                          const ifr = window.frameElement as HTMLIFrameElement;
                          if (!parent || parent == window || !ifr) //not iframe
                              return;
              Severity: Minor
              Found in zk/src/main/resources/web/js/zk/bookmark.ts - About 1 hr to fix

                Function _keyDataKey has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _keyDataKey(this: JQuery.KeyboardEventBase): string {
                        // Ref: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
                        var key = this.originalEvent!.key;
                        switch (key) {
                            case 'Scroll': return 'ScrollLock';
                Severity: Minor
                Found in zk/src/main/resources/web/js/zk/dom.ts - About 1 hr to fix

                  Function _cmOffset has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function _cmOffset(el: HTMLElement): zk.Offset {
                      var t = 0, l = 0, operaBug;
                      //Fix gecko difference, the offset of gecko excludes its border-width when its CSS position is relative or absolute
                      if (zk.gecko) {
                          var p = el.parentElement;
                  Severity: Minor
                  Found in zk/src/main/resources/web/js/zk/dom.ts - About 1 hr to fix

                    Function create has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        create(context) {
                            function checkBooleanTypeSyntax(node: TSESTree.TSTypeAnnotation | TSESTree.TSTypeAssertion | TSESTree.TSAsExpression) {
                                if (node.typeAnnotation.type === AST_NODE_TYPES.TSUnionType) {
                                    let booleanType:  TSESTree.TSBooleanKeyword | null | undefined;
                                    for (const t of node.typeAnnotation.types) {
                    Severity: Minor
                    Found in eslint-plugin-zk/src/rules/preferStrictBooleanType.ts - About 1 hr to fix

                      Function create has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Method indexOfUnderline has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static int indexOfUnderline(String s, int j) {
                                int k, last = s.length() - 2;
                                for (;(k = s.indexOf('_', j)) >= 0 && k < last; j = k + 1) {
                                    char cc = s.charAt(k + 1);
                                    if (cc < 'a' || cc > 'z') continue; //not found
                        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 equals has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                                public boolean equals(Object o) {
                                    if (this == o) return true;
                                    if (!(o instanceof Map.Entry))
                                        return false;
                                    Map.Entry e = (Map.Entry)o;
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/util/FilterMap.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 getContentType has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static final String getContentType(String format) {
                                if (format == null)
                                    return null;
                        
                                format = format.trim().toLowerCase(java.util.Locale.ENGLISH);
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/util/media/ContentTypes.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 valueOf has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static final String valueOf(Node node) {
                                if (node instanceof Item) {
                                    String v = ((Item)node).getText();
                                    return v != null ? v: "";
                                }
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/xml/Nodes.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 defaultResolveEntity has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected InputSource defaultResolveEntity(String publicId, String systemId)
                            throws SAXException {
                                if (systemId == null)
                                    return null;
                        
                        
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/idom/input/SAXHandler.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 setContent has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public final Object setContent(String path, Object obj) {
                                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 set has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            @SuppressWarnings({ "unchecked", "rawtypes" })
                            public static final void set(Object obj, String name, Object val,
                            boolean autoCoerce) throws NoSuchMethodException {
                                try {
                                    AccessibleObject acs;
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/reflect/Fields.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 toAttributeName has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static final String toAttributeName(String methodName) {
                                int len = methodName.length();
                                if (len < 2)
                                    return null;
                        
                        
                        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 checkAdd has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                                private void checkAdd(Attribute newItem, Attribute other, boolean replace) {
                                    //first, remove any existent with the same uri and name
                                    if (newItem.getOwner() != null)
                                        throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                            "Attribute, "+newItem.toString()+", owned by other; detach or clone it", getLocator());
                        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

                        Severity
                        Category
                        Status
                        Source
                        Language