node-xyz/xyz-core

View on GitHub

Showing 71 of 107 total issues

Function _httpExport has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var _httpExport = function (xMessageParam, next, end, xyz) {
    var requestConfig = xMessageParam.requestConfig;
    var responseCallback = xMessageParam.responseCallback;
    var postData = requestConfig.json;
    delete requestConfig.json;
Severity: Minor
Found in built/Transport/Middlewares/http.export.middleware.js - About 1 hr to fix

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

    let _httpExport = function (xMessageParam: ITransportSentMessageMwParam, next, end, xyz) {
      let requestConfig = xMessageParam.requestConfig
      let responseCallback = xMessageParam.responseCallback
    
      let postData = requestConfig.json
    Severity: Minor
    Found in src/Transport/Middlewares/http.export.middleware.ts - About 1 hr to fix

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

        createPathSubtree (path, fn: () => void) {
          let tokens = Path.getTokens(path)
          let tree = this.tree
          let stree = this.serializedTree
          for (let token of tokens) {
      Severity: Minor
      Found in src/Service/path.tree.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 call has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ServiceRepository.prototype.call = function (opt, responseCallback) {
              var nullFn = function () { };
              opt.payload = opt.payload || undefined;
              opt.servicePath = path_1.Path.format(opt.servicePath);
              if (!path_1.Path.validate(opt.servicePath)) {
      Severity: Minor
      Found in built/Service/service.repository.js - About 1 hr to fix

        Function call has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          call (opt: IxyzMessageConfig, responseCallback) {
            let nullFn = () => {}
            opt.payload = opt.payload || undefined
            opt.servicePath = Path.format(opt.servicePath)
        
        
        Severity: Minor
        Found in src/Service/service.repository.ts - About 1 hr to fix

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

            send (opt: ITransportSendMessageParams, responseCallback?) {
              opt.route = opt.route || 'CALL'
          
              if (!this.routes[opt.route]) {
                logger.error(`attempting to send message in route ${opt.route}. DOES NOT EXIST`)
          Severity: Minor
          Found in src/Transport/Transport.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 _genericTransportInvoke has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          function _genericTransportInvoke(params, next, end, xyz) {
              var targets = params.targets;
              var transport = xyz.serviceRepository.transport;
              var responseCallback = params.responseCallback;
              var logger = xyz.logger;
          Severity: Minor
          Found in built/Service/Middleware/service.generic.transport.js - 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 _genericTransportInvoke has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          export function _genericTransportInvoke (params: IServDiscMwParam, next, end, xyz: XYZ) {
            const targets = params.targets
            const transport = xyz.serviceRepository.transport
            const responseCallback = params.responseCallback
            const logger = xyz.logger
          Severity: Minor
          Found in src/Service/Middleware/service.generic.transport.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 (!selfConf[keys[0]])
                              selfConf[keys[0]] = {};
          Severity: Major
          Found in built/Config/config.global.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                            if (!selfConf[keys[0]][keys[1]])
                                selfConf[keys[1]] = {};
            Severity: Major
            Found in built/Config/config.global.js - About 45 mins to fix

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

              var UDPServer = (function (_super) {
                  __extends(UDPServer, _super);
                  function UDPServer(xyz, port) {
                      var _this = _super.call(this) || this;
                      _this.port = port;
              Severity: Minor
              Found in built/Transport/UDP/udp.server.js - About 45 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

              Avoid deeply nested control flow statements.
              Open

                      if (!selfConf[keys[0]]) selfConf[keys[0]] = {}
              Severity: Major
              Found in src/Config/config.global.ts - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if (pathIndex === pathToken.length - 1) {
                                        matches.push(computedPath.slice(1));
                                        break;
                                    }
                Severity: Major
                Found in built/Service/path.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                              if (end) end()
                  Severity: Major
                  Found in src/Service/Middleware/service.generic.transport.ts - About 45 mins to fix

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

                      setSystemConf: (aConf) => {
                        logger.info('CONFIG :: Setting default systemConf')
                        systemConf = CONSTANTS.defaultConfig.systemConf
                        logger.info('CONFIG :: reading systemConf from user')
                        systemConf = MergeRecursive(systemConf, aConf)
                    Severity: Minor
                    Found in src/Config/config.global.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 setSystemConf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        setSystemConf: function (aConf) {
                            Logger_1.logger.info('CONFIG :: Setting default systemConf');
                            systemConf = Constants_1.CONSTANTS.defaultConfig.systemConf;
                            Logger_1.logger.info('CONFIG :: reading systemConf from user');
                            systemConf = MergeRecursive(systemConf, aConf);
                    Severity: Minor
                    Found in built/Config/config.global.js - About 45 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Avoid deeply nested control flow statements.
                    Open

                            if (!selfConf[keys[0]][keys[1]]) selfConf[keys[1]] = {}
                    Severity: Major
                    Found in src/Config/config.global.ts - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                if (pathIndex === pathToken.length - 1) {
                                  matches.push(computedPath.slice(1))
                                  break
                                }
                      Severity: Major
                      Found in src/Service/path.ts - About 45 mins to fix

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

                          call (opt: IxyzMessageConfig, responseCallback) {
                            let nullFn = () => {}
                            opt.payload = opt.payload || undefined
                            opt.servicePath = Path.format(opt.servicePath)
                        
                        
                        Severity: Minor
                        Found in src/Service/service.repository.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 _sendToAll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function _sendToAll(params, next, done, xyz) {
                            var servicePath = params.opt.servicePath;
                            var userPayload = params.opt.payload;
                            var responseCallback = params.responseCallback;
                            var route = params.opt.route;
                        Severity: Minor
                        Found in built/Service/Middleware/service.send.to.all.js - 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

                        Severity
                        Category
                        Status
                        Source
                        Language