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

Summary

Maintainability
F
2 wks
Test Coverage

File au.ts has 1505 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* au.ts

    Purpose:
        ZK Client Engine
    Description:
Severity: Major
Found in zk/src/main/resources/web/js/zk/au.ts - About 4 days to fix

    Function sendNow has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
    Open

            export function sendNow(dt: zk.Desktop): boolean {
                if (zAu.disabledRequest) {
                    if (zk.processing)
                        zk.endProcessing();
                    return false;
    Severity: Minor
    Found in zk/src/main/resources/web/js/zk/au.ts - About 1 day 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 _doCmds has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

            export function _doCmds(sid?: string): void { //called by mount.js, too
                for (var fn: (() => void) | undefined; fn = doCmdFns.shift();)
                    fn();
    
                var ex: Error | undefined, j = 0, rid = responseId;
    Severity: Minor
    Found in zk/src/main/resources/web/js/zk/au.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 sendNow has 129 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            export function sendNow(dt: zk.Desktop): boolean {
                if (zAu.disabledRequest) {
                    if (zk.processing)
                        zk.endProcessing();
                    return false;
    Severity: Major
    Found in zk/src/main/resources/web/js/zk/au.ts - About 5 hrs to fix

      Function doProcess has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

      function doProcess(cmd: string, data: ({ $u?: string } & zk.Widget | undefined)[]): void { //decoded
          if (!dataNotReady(cmd, data)) {
              if (!zAu.processPhase) {
                  zAu.processPhase = cmd;
              }
      Severity: Minor
      Found in zk/src/main/resources/web/js/zk/au.ts - About 4 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 dataNotReady has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

      function dataNotReady(cmd: string, data: ({ $u?: string } & zk.Widget | undefined)[]): boolean {
          for (var j = data.length, id: string | undefined, w: zk.Widget | undefined; j--;)
              if (id = data[j] && data[j]!.$u) {
                  if (!(w = zk.Widget.$(id))) { //not ready
                      var processFn = function (): void {
      Severity: Minor
      Found in zk/src/main/resources/web/js/zk/au.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 _respFailure has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

              export function _respFailure(response: Response, reqInf: AuRequestInfo, rstatus: number): boolean {
                  var eru = zAu._errURIs['' + rstatus];
                  if (typeof eru == 'string') {
                      zUtl.go(eru);
                      return true;
      Severity: Minor
      Found in zk/src/main/resources/web/js/zk/au.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 _deconstructPacket has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

              export function _deconstructPacket(data: ArrayBufferView | unknown & { buffer?} | undefined, buffers: unknown[]): unknown {
                  if (!data) return data;
      
                  if (_isBinary(data)) {
                      const placeholder = { _placeholder: true, num: buffers.length };
      Severity: Minor
      Found in zk/src/main/resources/web/js/zk/au.ts - About 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 _onResponseReady has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

              export function _onResponseReady(response: Response): void {
                  var reqInf = zAu.ajaxReqInf, sid: string | undefined;
                  try {
                      if (response) {
                          zAu.ajaxReq = zAu.ajaxReqInf = undefined;
      Severity: Minor
      Found in zk/src/main/resources/web/js/zk/au.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 _respSuccess has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

              export function _respSuccess(response: Response, reqInf: AuRequestInfo, sid: string | number): boolean {
                  if (sid && sid != zAu.seqId) {
                      zAu._errCode = 'ZK-SID ' + (sid ? 'mismatch' : 'required');
                      zAu.afterResponse(); //continue the pending request if any
                      return true;
      Severity: Minor
      Found in zk/src/main/resources/web/js/zk/au.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 _doCmds has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              export function _doCmds(sid?: string): void { //called by mount.js, too
                  for (var fn: (() => void) | undefined; fn = doCmdFns.shift();)
                      fn();
      
                  var ex: Error | undefined, j = 0, rid = responseId;
      Severity: Major
      Found in zk/src/main/resources/web/js/zk/au.ts - About 2 hrs to fix

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

                export function _pfsend(dt: zk.Desktop, fetchOpts: RequestInit, completeOnly: boolean, forceAjax: boolean): void {
                    var ws = !forceAjax && typeof zWs != 'undefined' && zWs.ready,
                        fetchHeaders = fetchOpts.headers;
                    if (!completeOnly) {
                        var dtt = dt.id + '-' + pfIndex++ + '=' + Math.round(jq.now());
        Severity: Minor
        Found in zk/src/main/resources/web/js/zk/au.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 addAft has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

                    export function addAft(wgt: zk.Widget, ...codes: string[]): void {
                        const p = wgt.parent,
                            onSizeChildren: zk.Widget[] = [],
                            fn = function (child: zk.Widget): void {
                                var act = _beforeAction(child, 'show') as never;
        Severity: Minor
        Found in zk/src/main/resources/web/js/zk/au.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 clientInfo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

                    export function clientInfo(dtid?: string): void {
                        zAu._cInfoReg = true;
                        var orient = '',
                            dpr = 1.0;
        
        
        Severity: Minor
        Found in zk/src/main/resources/web/js/zk/au.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 doCmdsNow has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        function doCmdsNow(cmds: AuCommands): boolean {
            var rtags = cmds.rtags || {}, ex: undefined | Error;
            try {
                while (cmds && cmds.length) {
                    if (zk.mounting) return false;
        Severity: Minor
        Found in zk/src/main/resources/web/js/zk/au.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 _constructPacket has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

                export function _constructPacket(data: unknown | undefined, files: unknown[]): unknown {
                    if (!data) return data;
                    if (Array.isArray(data)) {
                        for (let i = 0; i < data.length; i++) {
                            data[i] = _constructPacket(data[i] as never, files);
        Severity: Minor
        Found in zk/src/main/resources/web/js/zk/au.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 ajaxSendNow has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function ajaxSendNow(reqInf: AuRequestInfo): void {
            var fetchOpts: RequestInit = {
                credentials: 'same-origin',
                method: 'POST',
                headers: reqInf.content instanceof FormData ? { 'ZK-SID': '' + reqInf.sid } : { 'Content-Type': zAu.ajaxSettings.contentType, 'ZK-SID': '' + reqInf.sid },
        Severity: Minor
        Found in zk/src/main/resources/web/js/zk/au.ts - About 1 hr to fix

          Function pushReqCmds has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

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

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

                  export function _rmDesktop(dt: zk.Desktop, dummy?: boolean): void {
                      var url = zk.ajaxURI(undefined, { desktop: dt, au: true }),
                          data = jq.param({
                              dtid: dt.id,
                              cmd_0: dummy ? 'dummy' : 'rmDesktop',
          Severity: Minor
          Found in zk/src/main/resources/web/js/zk/au.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 toJSON has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

                  export function toJSON(
                      target: zk.Widget | undefined,
                      data: // `pageX` and `pageY` should co-exist
                          | { pageX: number; pageY: number; x?: number; y?: number; z$dateKeys?: string[] }
                          | { pageX?: undefined; pageY?: undefined; x?: number; y?: number; z$dateKeys?: string[] }
          Severity: Minor
          Found in zk/src/main/resources/web/js/zk/au.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 beforeSend has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

                  export function beforeSend(uri: string, aureq: zk.Event, dt?: zk.Desktop): string {
                      var target: zk.Widget | undefined, tag: string | undefined;
                      if ((target = aureq.target) && (tag = target.autag)) {
                          tag = '/' + encodeURIComponent(tag);
                          if (!uri.includes('/_/')) {
          Severity: Minor
          Found in zk/src/main/resources/web/js/zk/au.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 _respFailure has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  export function _respFailure(response: Response, reqInf: AuRequestInfo, rstatus: number): boolean {
                      var eru = zAu._errURIs['' + rstatus];
                      if (typeof eru == 'string') {
                          zUtl.go(eru);
                          return true;
          Severity: Minor
          Found in zk/src/main/resources/web/js/zk/au.ts - About 1 hr to fix

            Function doCmdsNow has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function doCmdsNow(cmds: AuCommands): boolean {
                var rtags = cmds.rtags || {}, ex: undefined | Error;
                try {
                    while (cmds && cmds.length) {
                        if (zk.mounting) return false;
            Severity: Minor
            Found in zk/src/main/resources/web/js/zk/au.ts - About 1 hr to fix

              Function doProcess has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function doProcess(cmd: string, data: ({ $u?: string } & zk.Widget | undefined)[]): void { //decoded
                  if (!dataNotReady(cmd, data)) {
                      if (!zAu.processPhase) {
                          zAu.processPhase = cmd;
                      }
              Severity: Minor
              Found in zk/src/main/resources/web/js/zk/au.ts - About 1 hr to fix

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

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

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

                          export function encode(j: number, aureq: zk.Event, dt: zk.Desktop): string {
                              var target = aureq.target,
                                  opts = aureq.opts || {},
                                  portlet2Namespace = '';
                  
                  
                  Severity: Minor
                  Found in zk/src/main/resources/web/js/zk/au.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 addChd has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                              export function addChd(wgt: zk.Widget, ...rargs: string[]): void {
                                  if (wgt) {
                                      const onSizeChildren: zk.Widget[] = [],
                                          fn = function (child: zk.Widget): void {
                                              const act = _beforeAction(child, 'show') as never,
                  Severity: Minor
                  Found in zk/src/main/resources/web/js/zk/au.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 _rmDesktop has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          export function _rmDesktop(dt: zk.Desktop, dummy?: boolean): void {
                              var url = zk.ajaxURI(undefined, { desktop: dt, au: true }),
                                  data = jq.param({
                                      dtid: dt.id,
                                      cmd_0: dummy ? 'dummy' : 'rmDesktop',
                  Severity: Minor
                  Found in zk/src/main/resources/web/js/zk/au.ts - About 1 hr to fix

                    Function addAft has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                export function addAft(wgt: zk.Widget, ...codes: string[]): void {
                                    const p = wgt.parent,
                                        onSizeChildren: zk.Widget[] = [],
                                        fn = function (child: zk.Widget): void {
                                            var act = _beforeAction(child, 'show') as never;
                    Severity: Minor
                    Found in zk/src/main/resources/web/js/zk/au.ts - About 1 hr to fix

                      Function clientInfo has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  export function clientInfo(dtid?: string): void {
                                      zAu._cInfoReg = true;
                                      var orient = '',
                                          dpr = 1.0;
                      
                      
                      Severity: Minor
                      Found in zk/src/main/resources/web/js/zk/au.ts - About 1 hr to fix

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

                                    export function addChd(wgt: zk.Widget, ...rargs: string[]): void {
                                        if (wgt) {
                                            const onSizeChildren: zk.Widget[] = [],
                                                fn = function (child: zk.Widget): void {
                                                    const act = _beforeAction(child, 'show') as never,
                        Severity: Minor
                        Found in zk/src/main/resources/web/js/zk/au.ts - About 1 hr to fix

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

                                  export function _deconstructPacket(data: ArrayBufferView | unknown & { buffer?} | undefined, buffers: unknown[]): unknown {
                                      if (!data) return data;
                          
                                      if (_isBinary(data)) {
                                          const placeholder = { _placeholder: true, num: buffers.length };
                          Severity: Minor
                          Found in zk/src/main/resources/web/js/zk/au.ts - About 1 hr to fix

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

                                        export function wrongValue(...args: string[]): void {
                                            for (var i = 0, len = args.length - 1; i < len; i += 2) {
                                                var uuid = args[i], msg = args[i + 1],
                                                    wgt = zk.Widget.$(uuid);
                                                if (wgt) {
                            Severity: Minor
                            Found in zk/src/main/resources/web/js/zk/au.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 redirect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                                        export function redirect(url: string, target?: string): void {
                                            try {
                                                zUtl.go(url, { target: target });
                            
                                                // '#' for bookmark change only, Bug ZK-2874
                            Severity: Minor
                            Found in zk/src/main/resources/web/js/zk/au.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 showNotification has 8 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                        export function showNotification(msg: string, type: zul.wgt.NotificationType, pid: string, ref: zk.Widget,
                                            pos: string, off: zk.Offset, dur: number, closable: boolean): void {
                            Severity: Major
                            Found in zk/src/main/resources/web/js/zk/au.ts - About 1 hr to fix

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

                                      export function send(aureq: zk.Event, timeout = 0): void {
                                          //ZK-2790: when unload event is triggered, the desktop is destroyed
                                          //we shouldn't send request back to server
                                          if (zk.unloading && zk.rmDesktoping) //it's safer to check if both zk.unloading and zk.rmDesktoping are true
                                              return;
                              Severity: Minor
                              Found in zk/src/main/resources/web/js/zk/au.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 ajaxSend has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function ajaxSend(dt: zk.Desktop, aureq: zk.Event, timeout?: number): void {
                                  //ZK-1523: dt(desktop) could be null, so search the desktop from target's parent.
                                  //call stack: echo2() -> send()
                                  if (!dt) {
                                      //original dt is decided by aureq.target.desktop, so start by it's parent.
                              Severity: Minor
                              Found in zk/src/main/resources/web/js/zk/au.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 (zk.mounting) doCmdFns.push(fnPfDone);
                                                              else fnPfDone();
                              Severity: Major
                              Found in zk/src/main/resources/web/js/zk/au.ts - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if (Object.prototype.hasOwnProperty.call(data, key)) {
                                                        newData[key] = _deconstructPacket(data[key] as never, buffers);
                                                    }
                                Severity: Major
                                Found in zk/src/main/resources/web/js/zk/au.ts - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                              if (Object.hasOwn(content, key)) {
                                                                  reqContent += (reqContent.length ? '&' : '') + key + '=' + encodeURIComponent(content[key] as string);
                                                              }
                                  Severity: Major
                                  Found in zk/src/main/resources/web/js/zk/au.ts - About 45 mins to fix

                                    Function ajaxSendNow has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    function ajaxSendNow(reqInf: AuRequestInfo): void {
                                        var fetchOpts: RequestInit = {
                                            credentials: 'same-origin',
                                            method: 'POST',
                                            headers: reqInf.content instanceof FormData ? { 'ZK-SID': '' + reqInf.sid } : { 'Content-Type': zAu.ajaxSettings.contentType, 'ZK-SID': '' + reqInf.sid },
                                    Severity: Minor
                                    Found in zk/src/main/resources/web/js/zk/au.ts - About 45 mins to fix

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

                                    Function clearWrongValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                                export function clearWrongValue(...args: string[]): void {
                                                    for (var i = args.length; i--;) {
                                                        var wgt = zk.Widget.$(args[i]);
                                                        if (wgt) {
                                                            var toClearErrMsg = function (w: zk.Widget & { clearErrorMessage?() }) {
                                    Severity: Minor
                                    Found in zk/src/main/resources/web/js/zk/au.ts - About 45 mins to fix

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            do {
                                                                if (id = data[j] && data[j]!.$u)
                                                                    data[j] = zk.Widget.$(id) as never;
                                                            } while (j--);
                                    Severity: Major
                                    Found in zk/src/main/resources/web/js/zk/au.ts - About 45 mins to fix

                                      Consider simplifying this complex logical expression.
                                      Open

                                                  if (v != 410 //not timeout (SC_GONE)
                                                      && !(reqInf.rtags && reqInf.rtags.isDummy) //ZK-3304: dummy request shouldn't reset timeout
                                                      && (!reqInf.rtags || !reqInf.rtags.onTimer || zk.timerAlive)) // Bug ZK-2720 only timer-keep-alive should reset the timeout
                                                      zAu._resetTimeout();
                                      Severity: Major
                                      Found in zk/src/main/resources/web/js/zk/au.ts - About 40 mins to fix

                                        Consider simplifying this complex logical expression.
                                        Open

                                                    if ((v = response.headers.get('ZK-Error'))
                                                        && !zAu.onResponseError(response, v = zk.parseInt(v) ?? v)
                                                        && (v == 5501 || v == 5502) //Handle only ZK's SC_OUT_OF_SEQUENCE or SC_ACTIVATION_TIMEOUT
                                                        && zAu.confirmRetry('FAILED_TO_RESPONSE',
                                                            v == 5501 ? 'Request out of sequence' : 'Activation timeout')) {
                                        Severity: Major
                                        Found in zk/src/main/resources/web/js/zk/au.ts - About 40 mins to fix

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

                                                  export function _respException(reqInf: AuRequestInfo, e: Error): boolean {
                                                      if (!window.zAu)
                                                          return true; //the doc has been unloaded
                                          
                                                      zAu.ajaxReq = zAu.ajaxReqInf = undefined;
                                          Severity: Minor
                                          Found in zk/src/main/resources/web/js/zk/au.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

                                          Avoid too many return statements within this function.
                                          Open

                                                      return false;
                                          Severity: Major
                                          Found in zk/src/main/resources/web/js/zk/au.ts - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                        return true;
                                            Severity: Major
                                            Found in zk/src/main/resources/web/js/zk/au.ts - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                              return newData;
                                              Severity: Major
                                              Found in zk/src/main/resources/web/js/zk/au.ts - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                            return data;
                                                Severity: Major
                                                Found in zk/src/main/resources/web/js/zk/au.ts - About 30 mins to fix

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

                                                          export function sendAhead(aureq: zk.Event, timeout = 0): void {
                                                              const t = aureq.target;
                                                              if (t) {
                                                                  const dt = t instanceof zk.Desktop ? t : t.desktop!;
                                                                  zAu.getAuRequests(dt).unshift(aureq);
                                                  Severity: Minor
                                                  Found in zk/src/main/resources/web/js/zk/au.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 echo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                              export function echo(dtid?: string | zk.Desktop): void {
                                                                  var dt = zk.Desktop.$(dtid),
                                                                      aureqs = dt ? zAu.getAuRequests(dt) : [];
                                                                  // Bug ZK-2741
                                                                  for (var i = 0, j = aureqs.length; i < j; i++) {
                                                  Severity: Minor
                                                  Found in zk/src/main/resources/web/js/zk/au.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 pushCmds has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                  function pushCmds(cmds: AuCommands, rs: [string, ({ $u?: string } & zk.Widget | undefined)[]][]): void {
                                                      for (var j = 0, rl = rs ? rs.length : 0; j < rl; ++j) {
                                                          var r = rs[j],
                                                              cmd = r[0],
                                                              data = r[1];
                                                  Severity: Minor
                                                  Found in zk/src/main/resources/web/js/zk/au.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

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

                                                                  if (p && !p.z_rod)
                                                                      zk.afterMount(function () {
                                                                          if (zk(p).isRealVisible()) {
                                                                              zUtl.fireSized(p);
                                                                          } else {
                                                  Severity: Major
                                                  Found in zk/src/main/resources/web/js/zk/au.ts and 1 other location - About 3 hrs to fix
                                                  zk/src/main/resources/web/js/zk/au.ts on lines 2071..2081

                                                  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

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

                                                                  if (p && !p.z_rod)
                                                                      zk.afterMount(function () {
                                                                          if (zk(p).isRealVisible()) {
                                                                              zUtl.fireSized(p);
                                                                          } else {
                                                  Severity: Major
                                                  Found in zk/src/main/resources/web/js/zk/au.ts and 1 other location - About 3 hrs to fix
                                                  zk/src/main/resources/web/js/zk/au.ts on lines 2102..2112

                                                  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

                                                                  for (const key in data) {
                                                                      if (Object.prototype.hasOwnProperty.call(data, key)) {
                                                                          data[key] = _constructPacket(data[key] as never, files);
                                                                      }
                                                                  }
                                                  Severity: Major
                                                  Found in zk/src/main/resources/web/js/zk/au.ts and 1 other location - About 1 hr to fix
                                                  zk/src/main/resources/web/js/zk/au.ts on lines 1397..1401

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

                                                  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

                                                                  for (const key in data) {
                                                                      if (Object.prototype.hasOwnProperty.call(data, key)) {
                                                                          newData[key] = _deconstructPacket(data[key] as never, buffers);
                                                                      }
                                                                  }
                                                  Severity: Major
                                                  Found in zk/src/main/resources/web/js/zk/au.ts and 1 other location - About 1 hr to fix
                                                  zk/src/main/resources/web/js/zk/au.ts on lines 1366..1370

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

                                                  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 (ids = dt._pfRecvIds) {
                                                                  if (fetchHeaders) fetchHeaders['ZK-Client-Receive'] = ids;
                                                                  if (ws) {
                                                                      zWs.setRequestHeaders('ZK-Client-Receive', ids);
                                                                  }
                                                  Severity: Major
                                                  Found in zk/src/main/resources/web/js/zk/au.ts and 1 other location - About 1 hr to fix
                                                  zk/src/main/resources/web/js/zk/au.ts on lines 1076..1082

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

                                                  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 (ids = dt._pfDoneIds) {
                                                                  if (fetchHeaders) fetchHeaders['ZK-Client-Complete'] = ids;
                                                                  if (ws) {
                                                                      zWs.setRequestHeaders('ZK-Client-Complete', ids);
                                                                  }
                                                  Severity: Major
                                                  Found in zk/src/main/resources/web/js/zk/au.ts and 1 other location - About 1 hr to fix
                                                  zk/src/main/resources/web/js/zk/au.ts on lines 1069..1075

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

                                                  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

                                                                  for (let i = 0; i < data.length; i++) {
                                                                      newData[i] = _deconstructPacket(data[i] as never, buffers);
                                                                  }
                                                  Severity: Minor
                                                  Found in zk/src/main/resources/web/js/zk/au.ts and 1 other location - About 50 mins to fix
                                                  zk/src/main/resources/web/js/zk/au.ts on lines 1357..1359

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

                                                  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

                                                                  for (let i = 0; i < data.length; i++) {
                                                                      data[i] = _constructPacket(data[i] as never, files);
                                                                  }
                                                  Severity: Minor
                                                  Found in zk/src/main/resources/web/js/zk/au.ts and 1 other location - About 50 mins to fix
                                                  zk/src/main/resources/web/js/zk/au.ts on lines 1384..1386

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

                                                  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

                                                                  for (let args = arguments, j = 1; j < args.length; ++j)
                                                                      window.zkx_(args[j] as never, fn);
                                                  Severity: Minor
                                                  Found in zk/src/main/resources/web/js/zk/au.ts and 1 other location - About 40 mins to fix
                                                  zk/src/main/resources/web/js/zk/au.ts on lines 2131..2132

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

                                                  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

                                                                      for (let args = arguments, j = 1; j < args.length; ++j)
                                                                          window.zkx_(args[j] as never, fn);
                                                  Severity: Minor
                                                  Found in zk/src/main/resources/web/js/zk/au.ts and 1 other location - About 40 mins to fix
                                                  zk/src/main/resources/web/js/zk/au.ts on lines 2099..2100

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

                                                  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

                                                                  for (var c in code as Record<number | string, string>)
                                                                      zAu.setPushErrorURI(parseInt(c), code[c] as string);
                                                  Severity: Minor
                                                  Found in zk/src/main/resources/web/js/zk/au.ts and 1 other location - About 40 mins to fix
                                                  zk/src/main/resources/web/js/zk/au.ts on lines 510..511

                                                  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

                                                                  for (var c in code as Record<number | string, string>)
                                                                      zAu.setErrorURI(parseInt(c), code[c] as string);
                                                  Severity: Minor
                                                  Found in zk/src/main/resources/web/js/zk/au.ts and 1 other location - About 40 mins to fix
                                                  zk/src/main/resources/web/js/zk/au.ts on lines 537..538

                                                  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

                                                          export function _pfdone(dt: zk.Desktop, pfIds?: string | null): void {
                                                              zAu.pfAddIds(dt, '_pfDoneIds', pfIds);
                                                          }
                                                  Severity: Minor
                                                  Found in zk/src/main/resources/web/js/zk/au.ts and 1 other location - About 30 mins to fix
                                                  zk/src/main/resources/web/js/zk/au.ts on lines 1044..1046

                                                  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

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

                                                          export function _pfrecv(dt: zk.Desktop, pfIds?: string | null): void {
                                                              zAu.pfAddIds(dt, '_pfRecvIds', pfIds);
                                                          }
                                                  Severity: Minor
                                                  Found in zk/src/main/resources/web/js/zk/au.ts and 1 other location - About 30 mins to fix
                                                  zk/src/main/resources/web/js/zk/au.ts on lines 1051..1053

                                                  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