zk/src/main/resources/web/js/zk/dom.ts

Summary

Maintainability
F
3 wks
Test Coverage

File dom.ts has 1579 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable @typescript-eslint/dot-notation */
/* dom.ts

    Purpose:
        Enhance jQuery
Severity: Major
Found in zk/src/main/resources/web/js/zk/dom.ts - About 4 days to fix

    JQZK has 82 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class JQZK {
        /**
         * The associated instance of {@link JQZK.jq}, the object returned by `jq(...)`.
         */
        declare jq: JQuery;
    Severity: Major
    Found in zk/src/main/resources/web/js/zk/dom.ts - About 1 day to fix

      Function _scrlIntoView has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
      Open

      function _scrlIntoView(outer: HTMLElement | null, inner: HTMLElement | null, info: ScrollIntoViewInfo | undefined, excludeHorizontal: boolean): ScrollIntoViewInfo {
          if (outer && inner) {
              var ooft = zk(outer).revisedOffset(),
                  ioft = info ? info.oft : zk(inner).revisedOffset(),
                  top = ioft[1] - ooft[1]
      Severity: Minor
      Found in zk/src/main/resources/web/js/zk/dom.ts - About 6 hrs 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

      Function _scrollIntoView has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          _scrollIntoView(parent?: Element | boolean): this {
              // eslint-disable-next-line zk/noNull
              var n: HTMLElement | null = this.jq[0];
              if (n) {
                  var real = jq('#' + n.id + '-real')[0];
      Severity: Minor
      Found in zk/src/main/resources/web/js/zk/dom.ts - About 5 hrs 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

      Function position has 134 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          position(dim?: Dimension | Element, where?: string, opts?: PositionOptions): this {
              where = where || 'overlap';
      
              if (!dim) {
                  var bd = jq('body')[0];
      Severity: Major
      Found in zk/src/main/resources/web/js/zk/dom.ts - About 5 hrs to fix

        Function position has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            position(dim?: Dimension | Element, where?: string, opts?: PositionOptions): this {
                where = where || 'overlap';
        
                if (!dim) {
                    var bd = jq('body')[0];
        Severity: Minor
        Found in zk/src/main/resources/web/js/zk/dom.ts - About 3 hrs 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

        Function filterTextStyle has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            filterTextStyle(style: Record<string, string> | string, plus?: string[]): Record<string, string> | string {
                if (typeof style == 'string') {
                    let ts = '';
                    if (style)
                        for (var j = 0, k = 0; k >= 0; j = k + 1) {
        Severity: Minor
        Found in zk/src/main/resources/web/js/zk/dom.ts - About 3 hrs 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

        Function _cmOffset has a Cognitive Complexity of 25 (exceeds 5 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 3 hrs 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

        Function undoVParent has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            undoVParent(): this {
                if (this.hasVParent()) {
                    var el = this.jq[0],
                        p = el['z_vp'] as undefined | string,
                        agt = el['z_vpagt'] as string,
        Severity: Minor
        Found in zk/src/main/resources/web/js/zk/dom.ts - About 3 hrs 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

        `` has 27 functions (exceeds 20 allowed). Consider refactoring.
        Open

        Object.assign(jq, {
            nodeName(el?: Element, ...tags: string[]): boolean {
                var tag = el && el.nodeName ? el.nodeName.toLowerCase() : '',
                    j = arguments.length;
                if (j <= 1)
        Severity: Minor
        Found in zk/src/main/resources/web/js/zk/dom.ts - About 3 hrs to fix

          Function isScrollIntoView has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              isScrollIntoView(recursive?: boolean): boolean {// ZK-2069: can check whether the element is shown in parents' viewport.
                  var vOffset = this.viewportOffset(),
                      x = vOffset[0],
                      y = vOffset[1],
                      w = this.jq[0].offsetWidth,
          Severity: Minor
          Found in zk/src/main/resources/web/js/zk/dom.ts - About 2 hrs 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

          Function _overflowElement has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          function _overflowElement(self: JQZK, recursive): [HTMLElement, HTMLElement][] {
              // eslint-disable-next-line zk/noNull
              var el: Node | undefined | null = self.jq[0],
                  te, le, oels: [HTMLElement, HTMLElement][] = [];
              do {
          Severity: Minor
          Found in zk/src/main/resources/web/js/zk/dom.ts - About 2 hrs 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

          Consider simplifying this complex logical expression.
          Open

                  if (tolerant) {
                      return o2x1 <= o1x2 && o2x2 >= o1x1 && o2y1 <= o1y2 && o2y2 >= o1y1
                          && o1x2 - o2x1 > tolerant && o2x2 - o1x1 > tolerant
                          && o1y2 - o2y1 > tolerant && o2y2 - o1y1 > tolerant;
                  } else
          Severity: Critical
          Found in zk/src/main/resources/web/js/zk/dom.ts - About 2 hrs to fix

            Function center has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                center(flags?: string): this {
                    var el = this.jq[0],
                        wdgap = this.offsetWidth(),
                        hghgap = this.offsetHeight();
            
            
            Severity: Minor
            Found in zk/src/main/resources/web/js/zk/dom.ts - About 2 hrs 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

            Function _posOffset has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            function _posOffset(el: HTMLElement): zk.Offset {
                if (zk.webkit && el instanceof HTMLTableRowElement && el.cells.length)
                    el = el.cells[0];
            
                var t = 0, l = 0;
            Severity: Minor
            Found in zk/src/main/resources/web/js/zk/dom.ts - 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

            Function delayFunction has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            export function delayFunction(uuid: string, func: () => void, opts?: Partial<{ timeout: number; urgent: boolean }>): void {
                if (uuid && typeof func == 'function') {
                    if (!opts)
                        opts = {};
                    var timeout = opts.timeout,
            Severity: Minor
            Found in zk/src/main/resources/web/js/zk/dom.ts - 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

            Consider simplifying this complex logical expression.
            Open

                    if (x >= 0 && y >= 0 && x1 <= jq.innerWidth() && y1 <= jq.innerHeight()) {
                        var oels = _overflowElement(this, recursive),
                            inView = true;
                        for (var i = 0; i < oels.length; i++) {
                            // ZK-2619 : Errorbox not shown when WrongValueException is thrown on a multiline textbox
            Severity: Critical
            Found in zk/src/main/resources/web/js/zk/dom.ts - About 1 hr to fix

              Function _scrlIntoView has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function _scrlIntoView(outer: HTMLElement | null, inner: HTMLElement | null, info: ScrollIntoViewInfo | undefined, excludeHorizontal: boolean): ScrollIntoViewInfo {
                  if (outer && inner) {
                      var ooft = zk(outer).revisedOffset(),
                          ioft = info ? info.oft : zk(inner).revisedOffset(),
                          top = ioft[1] - ooft[1]
              Severity: Minor
              Found in zk/src/main/resources/web/js/zk/dom.ts - About 1 hr to fix

                Function init has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    init(sel: string | zk.Widget | HTMLElement, ctx, ...rest: unknown[]): JQuery {
                        if (ctx === zk) {
                            if (typeof sel == 'string'
                            && zUtl.isChar(sel.charAt(0), {digit: 1, upper: 1, lower: 1, '_': 1})) {
                                var el = document.getElementById(sel);
                Severity: Minor
                Found in zk/src/main/resources/web/js/zk/dom.ts - 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

                Function scrollbarWidth has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    scrollbarWidth(): number {
                        var devicePixelRatio = zUtl.getDevicePixelRatio(),
                            body = document.body;
                        if (this['_lastDevicePixelRatio'] != devicePixelRatio) {
                            this['_lastDevicePixelRatio'] = devicePixelRatio;
                Severity: Minor
                Found in zk/src/main/resources/web/js/zk/dom.ts - About 1 hr to fix

                  Function center has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      center(flags?: string): this {
                          var el = this.jq[0],
                              wdgap = this.offsetWidth(),
                              hghgap = this.offsetHeight();
                  
                  
                  Severity: Minor
                  Found in zk/src/main/resources/web/js/zk/dom.ts - About 1 hr to fix

                    Function _scrollIntoView has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _scrollIntoView(parent?: Element | boolean): this {
                            // eslint-disable-next-line zk/noNull
                            var n: HTMLElement | null = this.jq[0];
                            if (n) {
                                var real = jq('#' + n.id + '-real')[0];
                    Severity: Minor
                    Found in zk/src/main/resources/web/js/zk/dom.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 zk has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              zk(evt: JQuery.TriggeredEvent, wgt?: zk.Widget): zk.Event {
                                  var type = evt.type,
                                      target = zk.Widget.$(evt) ?? wgt,
                                      data;
                          
                          
                          Severity: Minor
                          Found in zk/src/main/resources/web/js/zk/dom.ts - 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

                          Function ncols has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              ncols(visibleOnly?: boolean): number {
                                  var row = this.jq[0],
                                      cnt = 0;
                                  if (row instanceof HTMLTableRowElement) {
                                      var cells = row.cells;
                          Severity: Minor
                          Found in zk/src/main/resources/web/js/zk/dom.ts - 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

                          Function undoVParent has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              undoVParent(): this {
                                  if (this.hasVParent()) {
                                      var el = this.jq[0],
                                          p = el['z_vp'] as undefined | string,
                                          agt = el['z_vpagt'] as string,
                          Severity: Minor
                          Found in zk/src/main/resources/web/js/zk/dom.ts - About 1 hr to fix

                            Function viewportOffset has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                                viewportOffset(): zk.Offset {
                                    // eslint-disable-next-line zk/noNull
                                    var t = 0, l = 0, el: HTMLElement | null = this.jq[0], p = el;
                                    while (p) {
                                        t += p.offsetTop || 0;
                            Severity: Minor
                            Found in zk/src/main/resources/web/js/zk/dom.ts - 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

                            Function scrollbarWidth has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                                scrollbarWidth(): number {
                                    var devicePixelRatio = zUtl.getDevicePixelRatio(),
                                        body = document.body;
                                    if (this['_lastDevicePixelRatio'] != devicePixelRatio) {
                                        this['_lastDevicePixelRatio'] = devicePixelRatio;
                            Severity: Minor
                            Found in zk/src/main/resources/web/js/zk/dom.ts - 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

                            Function redoCSS has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                redoCSS(timeout?: number, opts?: Partial<RedoCSSOptions>): this {
                                    if (opts?.fixFontIcon) {
                                        return this;
                                    }
                                    if (timeout == -1) { //timeout -1 means immediately
                            Severity: Minor
                            Found in zk/src/main/resources/web/js/zk/dom.ts - About 55 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

                            Function isRealScrollIntoView has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                isRealScrollIntoView(opt?: boolean): boolean {
                                    var wgt = this.$();
                                    if (!wgt)
                                        return false;
                                    var desktop = wgt.desktop,
                            Severity: Minor
                            Found in zk/src/main/resources/web/js/zk/dom.ts - About 55 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 (p == document.body) break;
                            Severity: Major
                            Found in zk/src/main/resources/web/js/zk/dom.ts - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if (jq(p).css('position') == 'absolute') {
                                                          isAbsolute = true;
                                                          break;
                                                      }
                              Severity: Major
                              Found in zk/src/main/resources/web/js/zk/dom.ts - About 45 mins to fix

                                Function on has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    on(type: string, selector: string | undefined, data, fn: CallableFunction, ...rest: unknown[]): JQuery {
                                Severity: Minor
                                Found in zk/src/main/resources/web/js/zk/dom.ts - About 35 mins to fix

                                  Function isOverlapped has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      isOverlapped(ofs1: zk.Offset, dim1: zk.Offset, ofs2: zk.Offset, dim2: zk.Offset, tolerant?: number): boolean {
                                  Severity: Minor
                                  Found in zk/src/main/resources/web/js/zk/dom.ts - About 35 mins to fix

                                    Function vflexHeight has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        vflexHeight(): number {
                                            var el = this.jq[0],
                                                parent = el.parentElement,
                                                hgh = parent ? zk(parent).clientHeightDoubleValue() : 0,
                                                zkp: undefined | zk.JQZK;
                                    Severity: Minor
                                    Found in zk/src/main/resources/web/js/zk/dom.ts - About 35 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

                                    Function revisedOffset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        revisedOffset(ofs?: zk.Offset): zk.Offset {
                                            var el = this.jq[0];
                                            if (!ofs) {
                                                if (el.getBoundingClientRect) { // IE and FF3
                                                    var elst: undefined | CSSStyleDeclaration, oldvisi: undefined | string,
                                    Severity: Minor
                                    Found in zk/src/main/resources/web/js/zk/dom.ts - About 35 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

                                    Function vparentNode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        vparentNode(real?: boolean): HTMLElement | undefined {
                                            var el = this.jq[0];
                                            if (el) {
                                                let v = el['z_vp'] as undefined | string; //might be empty
                                                if (v) return jq('#' + v)[0];
                                    Severity: Minor
                                    Found in zk/src/main/resources/web/js/zk/dom.ts - About 35 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

                                    Function _redoCSS0 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    function _redoCSS0(): void {
                                        if (_rdcss.length) {
                                            for (var el: HTMLElement | undefined; el = _rdcss.pop();)
                                                try {
                                                    zjq._fixCSS(el);
                                    Severity: Minor
                                    Found in zk/src/main/resources/web/js/zk/dom.ts - About 35 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

                                    Function nodeName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        nodeName(el?: Element, ...tags: string[]): boolean {
                                            var tag = el && el.nodeName ? el.nodeName.toLowerCase() : '',
                                                j = arguments.length;
                                            if (j <= 1)
                                                return !!tag;
                                    Severity: Minor
                                    Found in zk/src/main/resources/web/js/zk/dom.ts - About 25 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

                                    Function setSelectionRange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        setSelectionRange(start: number, end?: number): this {
                                            var inp = this.jq[0] as HTMLInputElement,
                                                len = inp.value ? inp.value.length : 0; //ZK-2805
                                            if (start == null || start < 0) start = 0;
                                            if (start > len) start = len;
                                    Severity: Minor
                                    Found in zk/src/main/resources/web/js/zk/dom.ts - About 25 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

                                    Function $ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        $<T extends zk.Widget>(opts?: Partial<{exact: boolean; strict: boolean; child: boolean}>): T {
                                            const e = this.jq[0];
                                            if (e) {
                                                const target = e[zk.Widget._TARGET] as T;
                                                if (target) {
                                    Severity: Minor
                                    Found in zk/src/main/resources/web/js/zk/dom.ts - About 25 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

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        hasHScroll(): boolean {
                                            var w: zk.Widget & {_scrollbar?: zul.Scrollbar} | undefined;
                                            if ((w = this.$()) && w._scrollbar) {// support a fake scrollbar
                                                return w._scrollbar.hasHScroll();
                                            }
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 1 day to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 511..523

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 212.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        hasVScroll(): boolean {
                                            var w: zk.Widget & {_scrollbar?: zul.Scrollbar} | undefined;
                                            if ((w = this.$()) && w._scrollbar) {// support a fake scrollbar
                                                return w._scrollbar.hasVScroll();
                                            }
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 1 day to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 528..540

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 212.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                            if (!flags) x = left + wdgap / 2;
                                            else if (flags.includes('left')) x = left;
                                            else if (flags.includes('right')) x = left + wdgap - 1; //just in case
                                            else if (flags.includes('center')) x = left + wdgap / 2;
                                            else {
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 4 hrs to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 870..876

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 119.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                            if (!flags) y = top + hghgap / 2;
                                            else if (flags.includes('top')) y = top;
                                            else if (flags.includes('bottom')) y = top + hghgap - 1; //just in case
                                            else if (flags.includes('center')) y = top + hghgap / 2;
                                            else {
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 4 hrs to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 861..867

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 119.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        offsetWidthDoubleValue(): number {
                                            const n = this.jq[0],
                                                width = n.getBoundingClientRect().width,
                                                diff = Math.abs(n.offsetWidth - width);
                                            if (diff > 0 && diff <= 1) {
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 3 hrs to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 1260..1268

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 101.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        offsetHeightDoubleValue(): number {
                                            const n = this.jq[0],
                                                height = n.getBoundingClientRect().height,
                                                diff = Math.abs(n.offsetHeight - height);
                                            if (diff > 0 && diff <= 1) {
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 3 hrs to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 1247..1255

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 101.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        revisedHeight(size: number, excludeMargin?: boolean): number {
                                            if (this.jq.css('box-sizing') != 'border-box')
                                                size -= this.padBorderHeight();
                                            if (size > 0 && excludeMargin)
                                                size -= this.marginHeight();
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 3 hrs to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 637..643

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 99.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        revisedWidth(size: number, excludeMargin?: boolean): number {
                                            if (this.jq.css('box-sizing') != 'border-box')
                                                size -= this.padBorderWidth();
                                            if (size > 0 && excludeMargin)
                                                size -= this.marginWidth();
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 3 hrs to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 659..665

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 99.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        contentWidth(excludeMargin?: boolean): number {
                                            var size = this.jq[0].offsetWidth;
                                            size -= this.padBorderWidth();
                                            if (size > 0 && excludeMargin)
                                                size -= this.marginWidth();
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 2 hrs to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 687..693

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 93.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        contentHeight(excludeMargin?: boolean): number {
                                            var size = this.jq[0].offsetHeight;
                                            size -= this.padBorderHeight();
                                            if (size > 0 && excludeMargin)
                                                size -= this.marginHeight();
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 2 hrs to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 673..679

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 93.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                            if (!te) {
                                                if (el == DocRoot() || (el as HTMLElement).style.overflow == 'auto' || (el as HTMLElement).style.overflowY == 'auto' || jq(el).css('overflow-y') == 'auto')
                                                    te = el;
                                            }
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 2 hrs to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 62..65

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 91.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                            if (!le) {
                                                if (el == DocRoot() || (el as HTMLElement).style.overflow == 'auto' || (el as HTMLElement).style.overflowX == 'auto' || jq(el).css('overflow-x') == 'auto')
                                                    le = el;
                                            }
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 2 hrs to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 58..61

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 91.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                            if (/*outer.clientHeight < inner.offsetHeight || */ outer.scrollTop > top) {
                                                outer.scrollTop = top;
                                                updated = true;
                                            } else if (bottom > outer.clientHeight + outer.scrollTop) {
                                                outer.scrollTop = !info ? bottom : bottom - (outer.clientHeight + (inner.parentNode == outer ? 0 : outer.scrollTop));
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 2 hrs to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 163..169

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 80.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                                if (outer.scrollLeft > left) {
                                                    outer.scrollLeft = left;
                                                    updated = true;
                                                } else if (right > outer.clientWidth + outer.scrollLeft) {
                                                    outer.scrollLeft = !info ? right : right - (outer.clientWidth + (inner.parentNode == outer ? 0 : outer.scrollLeft));
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 2 hrs to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 152..158

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 80.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                            if (type.startsWith('mouse')) {
                                                if (type.length > 5)
                                                    type = 'Mouse' + type.charAt(5).toUpperCase() + type.substring(6);
                                                data = (evt as JQuery.MouseEventBase).mouseData();
                                            } else if (type.startsWith('key')) {
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 2 hrs to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 2778..2789

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 78.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                            } else if (type.startsWith('key')) {
                                                if (type.length > 3)
                                                    type = 'Key' + type.charAt(3).toUpperCase() + type.substring(4);
                                                data = (evt as JQuery.KeyboardEventBase).keyData();
                                            } else if (type == 'dblclick') {
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 2 hrs to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 2774..2789

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 78.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                            try {
                                                alert(msg); // eslint-disable-line no-alert
                                            } finally {
                                                try {
                                                    zk.alerting = false;
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 1 hr to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 2402..2410

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 55.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                            try {
                                                return confirm(msg); // eslint-disable-line no-alert
                                            } finally {
                                                try {
                                                    zk.alerting = false;
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 1 hr to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 2479..2487

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 55.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        try {
                                            n.select();
                                        } catch (e) {
                                            zk.debugLog((e as Error).message ?? e);
                                        }
                                    Severity: Minor
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 40 mins to fix
                                    zk/src/main/resources/web/js/zk/pkg.ts on lines 76..80

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 48.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        innerX(): number {
                                            return Math.round(window.pageXOffset
                                                || DocRoot().scrollLeft || 0); //ZK-2633: browser might return decimal number
                                        },
                                    Severity: Minor
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 35 mins to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 2134..2137

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 46.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                        innerY(): number {
                                            return Math.round(window.pageYOffset
                                                || DocRoot().scrollTop || 0); //ZK-2633: browser might return decimal number
                                        },
                                    Severity: Minor
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 35 mins to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 2127..2130

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 46.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                            el = zk.gecko && el != document.body ?
                                                _ofsParent(el) : el.offsetParent as HTMLElement;
                                    Severity: Minor
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 30 mins to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 221..222

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 45.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                                el = zk.gecko && el != document.body ?
                                                    _ofsParent(el) : el.offsetParent as HTMLElement;
                                    Severity: Minor
                                    Found in zk/src/main/resources/web/js/zk/dom.ts and 1 other location - About 30 mins to fix
                                    zk/src/main/resources/web/js/zk/dom.ts on lines 236..237

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 45.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    There are no issues that match your filters.

                                    Category
                                    Status