node-xyz/xyz-core

View on GitHub

Showing 107 of 107 total issues

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

var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
Severity: Major
Found in built/Transport/UDP/udp.server.js and 2 other locations - About 1 day to fix
built/Service/service.repository.js on lines 1..10
built/Transport/HTTP/http.server.js on lines 1..10

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

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

var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
Severity: Major
Found in built/Transport/HTTP/http.server.js and 2 other locations - About 1 day to fix
built/Service/service.repository.js on lines 1..10
built/Transport/UDP/udp.server.js on lines 1..10

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

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

var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
Severity: Major
Found in built/Service/service.repository.js and 2 other locations - About 1 day to fix
built/Transport/HTTP/http.server.js on lines 1..10
built/Transport/UDP/udp.server.js on lines 1..10

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

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

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

    UDPServer.prototype.registerRoute = function (prefix, gmwh) {
        var globalUnique = this.xyz.serviceRepository.transport._checkUniqueRoute(prefix);
        if (!globalUnique) {
            Logger_1.logger.error("UDP Server @ " + this.port + " :: route " + prefix + " is not unique.");
            return false;
Severity: Major
Found in built/Transport/UDP/udp.server.js and 1 other location - About 7 hrs to fix
built/Transport/HTTP/http.server.js on lines 113..125

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

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

    HTTPServer.prototype.registerRoute = function (prefix, gmwh) {
        var globalUnique = this.xyz.serviceRepository.transport._checkUniqueRoute(prefix);
        if (!globalUnique) {
            Logger_1.logger.error("HTTP Server @ " + this.port + " :: route " + prefix + " is not unique.");
            return false;
Severity: Major
Found in built/Transport/HTTP/http.server.js and 1 other location - About 7 hrs to fix
built/Transport/UDP/udp.server.js on lines 87..99

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

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

  registerRoute (prefix, gmwh) {
    let globalUnique = this.xyz.serviceRepository.transport._checkUniqueRoute(prefix)
    if (!globalUnique) {
      logger.error(`HTTP Server @ ${this.port} :: route ${prefix} is not unique.`)
      return false
Severity: Major
Found in src/Transport/HTTP/http.server.ts and 1 other location - About 6 hrs to fix
src/Transport/UDP/udp.server.ts on lines 93..104

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

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

  registerRoute (prefix, gmwh) {
    let globalUnique = this.xyz.serviceRepository.transport._checkUniqueRoute(prefix)
    if (!globalUnique) {
      logger.error(`UDP Server @ ${this.port} :: route ${prefix} is not unique.`)
      return false
Severity: Major
Found in src/Transport/UDP/udp.server.ts and 1 other location - About 6 hrs to fix
src/Transport/HTTP/http.server.ts on lines 119..130

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

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 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
              Severity
              Category
              Status
              Source
              Language