RackHD/on-core

View on GitHub

Showing 326 of 326 total issues

File constants.js has 333 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright © 2015-2017 Dell Inc. or its subsidiaries.  All Rights Reserved.

'use strict';

module.exports = constantsFactory;
Severity: Minor
Found in lib/common/constants.js - About 4 hrs to fix

    Function connectionFactory has 97 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function connectionFactory (assert, amqp, Promise, util, _) {
        /**
         * Connection provides a wrapper around the AMQP connection logic
         * which presents a simplified interface for using multiple connections
         * in the messenger.
    Severity: Major
    Found in lib/common/connection.js - About 3 hrs to fix

      Function WaterlineServiceFactory has 97 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function WaterlineServiceFactory(
          Promise,
          configuration,
          assert,
          Waterline,
      Severity: Major
      Found in lib/services/waterline.js - About 3 hrs to fix

        Function prepareGrunt has 95 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function prepareGrunt(grunt) {
            var allFiles = [
                'package.json',
                'Gruntfile.js',
                'lib/**/*.js',
        Severity: Major
        Found in gruntfile.js - About 3 hrs to fix

          File lookup.js has 323 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // Copyright 2015, EMC, Inc.
          
          'use strict';
          
          module.exports = lookupServiceFactory;
          Severity: Minor
          Found in lib/services/lookup.js - About 3 hrs to fix

            Function messengerFactory has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

            function messengerFactory(
                Constants,
                Promise,
                assert,
                Connection,
            Severity: Minor
            Found in lib/common/messenger.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 heartbeatServiceFactory has 92 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function heartbeatServiceFactory(
                Promise,
                configuration,
                assert,
                Constants,
            Severity: Major
            Found in lib/services/heartbeat.js - About 3 hrs to fix

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

                  exports.persistGraphDefinition = function(definition) {
                      assert.object(definition, 'definition');
                      assert.string(definition.injectableName, 'definition.injectableName');
              
                      var query = {
              Severity: Major
              Found in lib/workflow/stores/mongo.js and 1 other location - About 3 hrs to fix
              lib/workflow/stores/mongo.js on lines 218..230

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

              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

                  exports.persistTaskDefinition = function(definition) {
                      assert.object(definition, 'definition');
                      assert.string(definition.injectableName, 'definition.injectableName');
              
                      var query = {
              Severity: Major
              Found in lib/workflow/stores/mongo.js and 1 other location - About 3 hrs to fix
              lib/workflow/stores/mongo.js on lines 181..193

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

              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

              function MacAddressFactory (assert, Serializable) {
                  function MacAddress (defaults) {
                      Serializable.call(
                          this,
                          MacAddress.schema,
              Severity: Major
              Found in lib/serializables/mac-address.js and 1 other location - About 3 hrs to fix
              lib/serializables/ip-address.js on lines 13..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 102.

              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

              function IpAddressFactory (assert, Serializable) {
                  function IpAddress (defaults) {
                      Serializable.call(
                          this,
                          IpAddress.schema,
              Severity: Major
              Found in lib/serializables/ip-address.js and 1 other location - About 3 hrs to fix
              lib/serializables/mac-address.js on lines 13..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 102.

              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

                  TaskProtocol.prototype.subscribeRunSnmpCommand = function (uuid, callback) {
                      assert.uuid(uuid, 'routing key uuid suffix');
                      assert.func(callback, 'callback');
              
                      return messenger.subscribe(
              Severity: Major
              Found in lib/protocol/task.js and 2 other locations - About 3 hrs to fix
              lib/protocol/task.js on lines 368..379
              lib/protocol/task.js on lines 461..472

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

              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

                  TaskProtocol.prototype.subscribeAnsibleCommand = function (uuid, callback) {
                      assert.uuid(uuid, 'routing key uuid suffix');
                      assert.func(callback, 'callback');
              
                      return messenger.subscribe(
              Severity: Major
              Found in lib/protocol/task.js and 2 other locations - About 3 hrs to fix
              lib/protocol/task.js on lines 355..366
              lib/protocol/task.js on lines 368..379

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

              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

                  TaskProtocol.prototype.subscribeSnmpCommandResult = function (uuid, callback) {
                      assert.uuid(uuid, 'routing key uuid suffix');
                      assert.func(callback, 'callback');
              
                      return messenger.subscribe(
              Severity: Major
              Found in lib/protocol/task.js and 2 other locations - About 3 hrs to fix
              lib/protocol/task.js on lines 355..366
              lib/protocol/task.js on lines 461..472

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

              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

                      return this.lookupByMAC(macAddress)
                      .then(function (record) {
                          if (record.node) {
                              return self.assignNodeIdCache(macAddress, record.node);
                          }
              Severity: Major
              Found in lib/services/lookup.js and 1 other location - About 3 hrs to fix
              lib/services/lookup.js on lines 445..457

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

              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

                      return this.lookupByIP(ip).then(function (record) {
                          if (record.node) {
                              return self.assignNodeIdCache(ip, record.node);
                          }
                          else {
              Severity: Major
              Found in lib/services/lookup.js and 1 other location - About 3 hrs to fix
              lib/services/lookup.js on lines 389..402

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

              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

              File task-graph-runner.js has 302 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              // Copyright 2015-2016, EMC, Inc.
              
              'use strict';
              
              module.exports = taskGraphRunnerProtocolFactory;
              Severity: Minor
              Found in lib/protocol/task-graph-runner.js - About 3 hrs to fix

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

                    EventsProtocol.prototype.subscribeSkuAssigned = function (nodeId, callback) {
                        assert.isMongoId(nodeId);
                        assert.func(callback);
                
                        return messenger.subscribe(
                Severity: Major
                Found in lib/protocol/events.js and 1 other location - About 3 hrs to fix
                lib/protocol/task.js on lines 177..188

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

                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

                    TaskProtocol.prototype.subscribeRespondCommands = function (identifier, callback) {
                        assert.ok(identifier);
                        assert.func(callback);
                
                        return messenger.subscribe(
                Severity: Major
                Found in lib/protocol/task.js and 1 other location - About 3 hrs to fix
                lib/protocol/events.js on lines 277..288

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

                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 WorkItemModelFactory has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                function WorkItemModelFactory (
                    Model,
                    _,
                    Promise,
                    assert,
                Severity: Minor
                Found in lib/models/work-item.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

                Severity
                Category
                Status
                Source
                Language