node-xyz/xyz-core

View on GitHub

Showing 107 of 107 total issues

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

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

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

      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

      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

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

                for (let s in this.servers) {
                  ret.servers.push(this.servers[s].inspectJSON())
                }
            Severity: Minor
            Found in src/Transport/Transport.ts and 1 other location - About 35 mins to fix
            src/Transport/Transport.ts on lines 50..52

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

            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 route in this.routes) {
                        ret.outgoingRoutes.push(this.routes[route].inspectJSON());
                    }
            Severity: Minor
            Found in built/Transport/Transport.js and 1 other location - About 35 mins to fix
            built/Transport/Transport.js on lines 38..40

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

            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 s in this.servers) {
                        ret.servers.push(this.servers[s].inspectJSON());
                    }
            Severity: Minor
            Found in built/Transport/Transport.js and 1 other location - About 35 mins to fix
            built/Transport/Transport.js on lines 35..37

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

            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 route in this.routes) {
                  ret.outgoingRoutes.push(this.routes[route].inspectJSON())
                }
            Severity: Minor
            Found in src/Transport/Transport.ts and 1 other location - About 35 mins to fix
            src/Transport/Transport.ts on lines 54..56

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

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

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

            function MergeRecursive(obj1, obj2) {
                for (var p in obj2) {
                    try {
                        if (obj2[p].constructor === Object) {
                            obj1[p] = MergeRecursive(obj1[p], obj2[p]);
            Severity: Minor
            Found in built/Config/config.global.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

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

            function _sendToAll (params: IServDiscMwParam, next, done, xyz:XYZ) {
              let servicePath = params.opt.servicePath
              let userPayload = params.opt.payload
              let responseCallback = params.responseCallback
              let route = params.opt.route
            Severity: Minor
            Found in src/Service/Middleware/service.send.to.all.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 MergeRecursive has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function MergeRecursive (obj1, obj2) {
              for (let p in obj2) {
                try {
                  if (obj2[p].constructor === Object) {
                    obj1[p] = MergeRecursive(obj1[p], obj2[p])
            Severity: Minor
            Found in src/Config/config.global.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

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

                    for (var _i = 1; _i < arguments.length; _i++) {
                        args[_i - 1] = arguments[_i];
                    }
            Severity: Minor
            Found in built/Transport/transport.interfaces.js and 1 other location - About 35 mins to fix
            built/xyz.js on lines 162..164

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

            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 (var _i = 1; _i < arguments.length; _i++) {
                        args[_i - 1] = arguments[_i];
                    }
            Severity: Minor
            Found in built/xyz.js and 1 other location - About 35 mins to fix
            built/Transport/transport.interfaces.js on lines 5..7

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

            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

            Avoid too many return statements within this function.
            Open

                    return Util_1.wrapper('red', level);
            Severity: Major
            Found in built/Log/Logger.js - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language