node-xyz/xyz-core

View on GitHub

Showing 107 of 107 total issues

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

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

      logger.verbose(`${wrapper('bold', 'BROADCAST LOCAL')} :: sending message to ${calls.map((o) => o.node + ':' + o.match)},  `)
    Severity: Major
    Found in src/Service/Middleware/service.broadcast.local.ts and 1 other location - About 1 hr to fix
    src/Service/Middleware/service.broadcast.global.ts on lines 28..28

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

    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

      logger.verbose(`${wrapper('bold', 'BROADCAST GLOBAL')} :: sending message to ${calls.map((o) => o.node + ':' + o.match)},  `)
    Severity: Major
    Found in src/Service/Middleware/service.broadcast.global.ts and 1 other location - About 1 hr to fix
    src/Service/Middleware/service.broadcast.local.ts on lines 33..33

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

    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

    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

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

          HTTPServer.prototype.terminate = function () {
              Logger_1.logger.warn("HTTP Server @ " + this.port + " :: CLOSING");
              this.close();
          };
      Severity: Major
      Found in built/Transport/HTTP/http.server.js and 1 other location - About 1 hr to fix
      built/Transport/UDP/udp.server.js on lines 79..82

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

      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

          UDPServer.prototype.terminate = function () {
              Logger_1.logger.warn("UDP SERVER @ " + this.port + " :: CLOSING");
              this.close();
          };
      Severity: Major
      Found in built/Transport/UDP/udp.server.js and 1 other location - About 1 hr to fix
      built/Transport/HTTP/http.server.js on lines 129..132

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

      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

      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

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

          inspectJSON () {
            let ret = []
            for (let route in this.routes) ret.push(this.routes[route].inspectJSON())
            return ret
          }
        Severity: Major
        Found in src/Transport/UDP/udp.server.ts and 1 other location - About 1 hr to fix
        src/Transport/HTTP/http.server.ts on lines 93..97

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 55.

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

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

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

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

        Refactorings

        Further Reading

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

          inspectJSON () {
            let ret = []
            for (let route in this.routes) ret.push(this.routes[route].inspectJSON())
            return ret
          }
        Severity: Major
        Found in src/Transport/HTTP/http.server.ts and 1 other location - About 1 hr to fix
        src/Transport/UDP/udp.server.ts on lines 68..72

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 55.

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

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

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

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

        Refactorings

        Further Reading

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

        let client = new XYZ({
          selfConf: {name: 'client.ms', transport: [{type: 'HTTP', port: 4000}]},
          systemConf: {nodes: ['127.0.0.1:5000']}
        })
        Severity: Minor
        Found in examples/load-balancer/client.ms.js and 1 other location - About 55 mins to fix
        examples/load-balancer/worker.ms.js on lines 3..6

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

        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

        let worker = new XYZ({
          selfConf: {name: 'worker.ms', transport: [{type: 'HTTP', port: 3000}]},
          systemConf: {nodes: ['127.0.0.1:5000']}
        })
        Severity: Minor
        Found in examples/load-balancer/worker.ms.js and 1 other location - About 55 mins to fix
        examples/load-balancer/client.ms.js on lines 3..6

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

        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

        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

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

                    for (var _a = 0, joinCandidate_1 = joinCandidate; _a < joinCandidate_1.length; _a++) {
                        var cNode = joinCandidate_1[_a];
                        _loop_2(cNode);
                    }
            Severity: Major
            Found in built/Bootstrap/ping.basic.js and 2 other locations - About 45 mins to fix
            built/Bootstrap/ping.basic.js on lines 80..83
            built/Service/Middleware/service.generic.transport.js on lines 50..53

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

            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 3 locations. Consider refactoring.
            Open

                    for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
                        var node = nodes_1[_i];
                        _loop_1(node);
                    }
            Severity: Major
            Found in built/Bootstrap/ping.basic.js and 2 other locations - About 45 mins to fix
            built/Bootstrap/ping.basic.js on lines 100..103
            built/Service/Middleware/service.generic.transport.js on lines 50..53

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

            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

            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

            Severity
            Category
            Status
            Source
            Language