node-xyz/xyz-core

View on GitHub

Showing 71 of 107 total issues

Function Transport has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

var Transport = (function () {
    /**
     * Transport layer. This layer is an abstraction above all different sorts of communication.
     */
    function Transport(xyz) {
Severity: Minor
Found in built/Transport/Transport.js - About 7 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 ServiceRepository has 143 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var ServiceRepository = (function (_super) {
    __extends(ServiceRepository, _super);
    /**
     * Creates a new ServiceRepository
     * Transport client and server will be composed by ServiceRepository
Severity: Major
Found in built/Service/service.repository.js - About 5 hrs to fix

    Function Transport has 140 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var Transport = (function () {
        /**
         * Transport layer. This layer is an abstraction above all different sorts of communication.
         */
        function Transport(xyz) {
    Severity: Major
    Found in built/Transport/Transport.js - About 5 hrs to fix

      Function _basicPingBootstrap has 127 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function _basicPingBootstrap(xyz, event, port) {
          var Util = xyz.Util;
          var wrapper = Util.wrapper;
          var logger = xyz.logger;
          var CONFIG = xyz.CONFIG;
      Severity: Major
      Found in built/Bootstrap/ping.basic.js - About 5 hrs to fix

        Function setSelfConf has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

            setSelfConf: function (aConf, cmdLineArgs) {
                Logger_1.logger.info('CONFIG :: Setting default selfConf');
                selfConf = Constants_1.CONSTANTS.defaultConfig.selfConf;
                Logger_1.logger.info('CONFIG :: Reading selfConf from user');
                selfConf = MergeRecursive(selfConf, aConf);
        Severity: Minor
        Found in built/Config/config.global.js - 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 setSelfConf has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

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

        var ServiceRepository = (function (_super) {
            __extends(ServiceRepository, _super);
            /**
             * Creates a new ServiceRepository
             * Transport client and server will be composed by ServiceRepository
        Severity: Minor
        Found in built/Service/service.repository.js - 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 NodeXYZ has 115 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var NodeXYZ = (function () {
            /**
             * create a new xyz object
             * @param {Object} configuration configuration should have two main keys:
             *   - selfConf
        Severity: Major
        Found in built/xyz.js - About 4 hrs to fix

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

          var PathTree = (function () {
              function PathTree() {
                  this.tree = {
                      '': {
                          subtree: {}
          Severity: Minor
          Found in built/Service/path.tree.js - 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 _basicPingBootstrap has 112 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function _basicPingBootstrap (xyz: INodeXYZ, event, port) {
            let Util = xyz.Util
            let wrapper = Util.wrapper
            let logger = xyz.logger
            let CONFIG = xyz.CONFIG
          Severity: Major
          Found in src/Bootstrap/ping.basic.ts - About 4 hrs to fix

            Function match has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                match: function (path, serializedTree) {
                    var matches = [];
                    var pathToken = path.split('/');
                    var pathIndex = 0;
                    var pathTree = serializedTree;
            Severity: Minor
            Found in built/Service/path.js - 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 match has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

              match (path, serializedTree) {
                let matches = []
                let pathToken = path.split('/')
                let pathIndex = 0
                let pathTree = serializedTree
            Severity: Minor
            Found in src/Service/path.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 HTTPServer has 97 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var HTTPServer = (function (_super) {
                __extends(HTTPServer, _super);
                /**
                 * Creates a new HTTP server
                 * @param xyz {Object} a reference to the curretn xyz object. will be filled automatically.
            Severity: Major
            Found in built/Transport/HTTP/http.server.js - About 3 hrs to fix

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

              var GenericMiddlewareHandler = (function () {
                  function GenericMiddlewareHandler(xyz, name, route) {
                      this.middlewares = [];
                      this.xyz = xyz;
                      this.name = name;
              Severity: Minor
              Found in built/Middleware/generic.middleware.handler.js - 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 GenericMiddlewareHandler has 76 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var GenericMiddlewareHandler = (function () {
                  function GenericMiddlewareHandler(xyz, name, route) {
                      this.middlewares = [];
                      this.xyz = xyz;
                      this.name = name;
              Severity: Major
              Found in built/Middleware/generic.middleware.handler.js - About 3 hrs to fix

                Function PathTree has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var PathTree = (function () {
                    function PathTree() {
                        this.tree = {
                            '': {
                                subtree: {}
                Severity: Major
                Found in built/Service/path.tree.js - About 2 hrs to fix

                  Function UDPServer has 68 lines of code (exceeds 25 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: Major
                  Found in built/Transport/UDP/udp.server.js - About 2 hrs to fix

                    Function _ping has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function _ping() {
                            var nodes = CONFIG.getSystemConf().nodes;
                            var _loop_1 = function (node) {
                                SR.transport.send({
                                    route: 'PING',
                    Severity: Major
                    Found in built/Bootstrap/ping.basic.js - About 2 hrs to fix

                      Function _genericTransportInvoke has 51 lines of code (exceeds 25 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: Major
                      Found in built/Service/Middleware/service.generic.transport.js - About 2 hrs to fix

                        Function HTTPServer has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function HTTPServer(xyz, port) {
                                var _this = _super.call(this) || this;
                                http.globalAgent.maxSockets = Infinity;
                                _this.port = port || config_global_1.CONFIG.getSelfConf().transport[0].port;
                                _this.xyz = xyz;
                        Severity: Minor
                        Found in built/Transport/HTTP/http.server.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language