RackHD/on-core

View on GitHub

Showing 326 of 326 total issues

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

    TaskGraphRunnerProtocol.prototype.subscribeDefineTask = function (callback) {
        assert.func(callback);

        return messenger.subscribe(
            Constants.Protocol.Exchanges.TaskGraphRunner.Name,
Severity: Major
Found in lib/protocol/task-graph-runner.js and 6 other locations - About 6 hrs to fix
lib/protocol/dhcp.js on lines 211..229
lib/protocol/task-graph-runner.js on lines 42..60
lib/protocol/task-graph-runner.js on lines 78..96
lib/protocol/task-graph-runner.js on lines 113..131
lib/protocol/task-graph-runner.js on lines 147..165
lib/protocol/task-graph-runner.js on lines 179..197

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

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

    EventsProtocol.prototype.publishGraphStarted = function (graphid, data, nodeId) {
        var self = this;
        assert.uuid(graphid);
        assert.object(data);
        assert.uuid(data.graphId);
Severity: Major
Found in lib/protocol/events.js and 1 other location - About 6 hrs to fix
lib/protocol/events.js on lines 236..251

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

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

    EventsProtocol.prototype.publishGraphFinished = function (graphid, data, nodeId) {
        var self = this;
        assert.uuid(graphid);
        assert.object(data);
        assert.uuid(data.graphId);
Severity: Major
Found in lib/protocol/events.js and 1 other location - About 6 hrs to fix
lib/protocol/events.js on lines 206..221

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

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.js has 425 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright 2015, EMC, Inc.

'use strict';

module.exports = taskProtocolFactory;
Severity: Minor
Found in lib/protocol/task.js - About 6 hrs to fix

    Function LogEventFactory has 154 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function LogEventFactory (
        Errors,
        Constants,
        Serializable,
        lookupService,
    Severity: Major
    Found in lib/serializables/log-event.js - About 6 hrs to fix

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

      function updateKeys(obj, _) {
          var newObj = null;
          if (_.isArray(obj)) {
              newObj = [];
          } else if (_.isObject(obj)) {
      Severity: Major
      Found in lib/models/log.js and 1 other location - About 6 hrs to fix
      lib/models/catalog.js on lines 85..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 158.

      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

      function updateKeys(obj, _) {
          var newObj = null;
          if (_.isArray(obj)) {
              newObj = [];
          } else if (_.isObject(obj)) {
      Severity: Major
      Found in lib/models/catalog.js and 1 other location - About 6 hrs to fix
      lib/models/log.js on lines 74..92

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

      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

          TaskGraphRunnerProtocol.prototype.subscribePauseTaskGraph = function (callback) {
              assert.func(callback);
      
              return messenger.subscribe(
                  Constants.Protocol.Exchanges.TaskGraphRunner.Name,
      Severity: Major
      Found in lib/protocol/task-graph-runner.js and 1 other location - About 6 hrs to fix
      lib/protocol/task-graph-runner.js on lines 267..285

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

      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

          TaskGraphRunnerProtocol.prototype.subscribeCancelTaskGraph = function (callback) {
              assert.func(callback);
      
              return messenger.subscribe(
                  Constants.Protocol.Exchanges.TaskGraphRunner.Name,
      Severity: Major
      Found in lib/protocol/task-graph-runner.js and 1 other location - About 6 hrs to fix
      lib/protocol/task-graph-runner.js on lines 302..320

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

      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 ErrorFactory has 136 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function ErrorFactory(util) {
          /**
           * Base error object which should be inherited, not used directly.
           * @constructor
           * @param {string} message Error Message
      Severity: Major
      Found in lib/common/errors.js - About 5 hrs to fix

        Function HttpFactory has 136 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function HttpFactory(assert, Promise, _) {
            
            /**
            * Tool class that does HTTP methods
            * @constructor
        Severity: Major
        Found in lib/common/http-tool.js - About 5 hrs to fix

          `` has 39 functions (exceeds 20 allowed). Consider refactoring.
          Open

              return Waterline.Collection.extend({
                  attributes: {
                      identifiers: {
                          type: 'array',
                          required: false
          Severity: Minor
          Found in lib/common/model.js - About 5 hrs to fix

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

                    return messenger.subscribe(
                        Constants.Protocol.Exchanges.Task.Name,
                        'methods.getBootProfile' + '.' + nodeId,
                        function(data, message) {
                            Promise.resolve().then(function() {
            Severity: Major
            Found in lib/protocol/task.js and 1 other location - About 5 hrs to fix
            lib/protocol/task.js on lines 239..253

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

            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 messenger.subscribe(
                        Constants.Protocol.Exchanges.Task.Name,
                        'methods.activeTaskExists' + '.' + target,
                        function(data, message) {
                            Promise.resolve().then(function() {
            Severity: Major
            Found in lib/protocol/task.js and 1 other location - About 5 hrs to fix
            lib/protocol/task.js on lines 206..221

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

            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 events.js has 368 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // Copyright 2015, EMC, Inc.
            
            'use strict';
            
            module.exports = eventsProtocolFactory;
            Severity: Minor
            Found in lib/protocol/events.js - About 4 hrs to fix

              Function jsonSchemaValidatorFactory has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

              function jsonSchemaValidatorFactory(
                  Ajv,
                  assert,
                  nodeFs,
                  path,
              Severity: Minor
              Found in lib/common/json-schema-validator.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 LogEventFactory has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

              function LogEventFactory (
                  Errors,
                  Constants,
                  Serializable,
                  lookupService,
              Severity: Minor
              Found in lib/serializables/log-event.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

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

                      types: {
                          skuRules: function(rules) {
                              assert.arrayOfObject(rules, 'rules');
                              _.forEach(rules, function (rule) {
                                  assert.string(rule.path, 'rule.path');
              Severity: Major
              Found in lib/models/sku.js and 1 other location - About 4 hrs to fix
              lib/models/tags.js on lines 22..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 126.

              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

                      types: {
                          tagRules: function(rules) {
                              assert.arrayOfObject(rules, 'rules');
                              _.forEach(rules, function (rule) {
                                  assert.string(rule.path, 'rule.path');
              Severity: Major
              Found in lib/models/tags.js and 1 other location - About 4 hrs to fix
              lib/models/sku.js on lines 21..32

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

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

              function mongoStoreFactory(waterline, Promise, Constants, Errors, assert, _) {
                  var exports = {};
              
                  exports.publishRecordByGraphId = function (graphId, event) {
                      return waterline.graphobjects.needOneMongo(
              Severity: Minor
              Found in lib/workflow/stores/mongo.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

              Severity
              Category
              Status
              Source
              Language