RackHD/on-core

View on GitHub
lib/protocol/events.js

Summary

Maintainability
F
1 wk
Test Coverage

Function eventsProtocolFactory has 344 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function eventsProtocolFactory (
    Constants,
    _,
    messenger,
    hook,
Severity: Major
Found in lib/protocol/events.js - About 1 day to fix

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

      function eventsProtocolFactory (
          Constants,
          _,
          messenger,
          hook,
      Severity: Minor
      Found in lib/protocol/events.js - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function publishTaskFinished has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

                  domain, taskId, taskName, graphId, graphName, state, error, context, terminalOnStates) {
      Severity: Major
      Found in lib/protocol/events.js - About 1 hr to fix

        Function eventsProtocolFactory has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            Constants,
            _,
            messenger,
            hook,
            Promise,
        Severity: Major
        Found in lib/protocol/events.js - About 1 hr to fix

          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

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

              EventsProtocol.prototype.subscribeGraphStarted = function (graphid, callback) {
                  assert.uuid(graphid);
                  assert.func(callback);
          
                  return messenger.subscribe(
          Severity: Major
          Found in lib/protocol/events.js and 1 other location - About 2 hrs to fix
          lib/protocol/events.js on lines 253..264

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

          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.subscribeGraphFinished = function (graphid, callback) {
                  assert.uuid(graphid);
                  assert.func(callback);
          
                  return messenger.subscribe(
          Severity: Major
          Found in lib/protocol/events.js and 1 other location - About 2 hrs to fix
          lib/protocol/events.js on lines 223..234

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

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

              EventsProtocol.prototype.subscribeTftpFailure = function (nodeId, callback) {
                  assert.isMongoId(nodeId);
                  assert.func(callback);
          
                  return messenger.subscribe(
          Severity: Major
          Found in lib/protocol/events.js and 9 other locations - About 2 hrs to fix
          lib/protocol/events.js on lines 32..41
          lib/protocol/events.js on lines 43..52
          lib/protocol/events.js on lines 54..63
          lib/protocol/events.js on lines 76..85
          lib/protocol/events.js on lines 87..96
          lib/protocol/events.js on lines 98..106
          lib/protocol/events.js on lines 108..116
          lib/protocol/events.js on lines 118..127
          lib/protocol/events.js on lines 129..138

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

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

              EventsProtocol.prototype.publishHttpResponse = function (nodeId, data) {
                  assert.string(nodeId);
                  assert.object(data);
          
                  return messenger.publish(
          Severity: Major
          Found in lib/protocol/events.js and 9 other locations - About 2 hrs to fix
          lib/protocol/events.js on lines 32..41
          lib/protocol/events.js on lines 43..52
          lib/protocol/events.js on lines 54..63
          lib/protocol/events.js on lines 65..74
          lib/protocol/events.js on lines 87..96
          lib/protocol/events.js on lines 98..106
          lib/protocol/events.js on lines 108..116
          lib/protocol/events.js on lines 118..127
          lib/protocol/events.js on lines 129..138

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

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

              EventsProtocol.prototype.publishDhcpBoundLease = function (nodeId, data) {
                  assert.string(nodeId);
                  assert.object(data);
          
                  return messenger.publish(
          Severity: Major
          Found in lib/protocol/events.js and 9 other locations - About 2 hrs to fix
          lib/protocol/events.js on lines 32..41
          lib/protocol/events.js on lines 43..52
          lib/protocol/events.js on lines 54..63
          lib/protocol/events.js on lines 65..74
          lib/protocol/events.js on lines 76..85
          lib/protocol/events.js on lines 87..96
          lib/protocol/events.js on lines 98..106
          lib/protocol/events.js on lines 108..116
          lib/protocol/events.js on lines 129..138

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

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

              EventsProtocol.prototype.publishTftpFailure = function (nodeId, data) {
                  assert.string(nodeId);
                  assert.object(data);
          
                  return messenger.publish(
          Severity: Major
          Found in lib/protocol/events.js and 9 other locations - About 2 hrs to fix
          lib/protocol/events.js on lines 32..41
          lib/protocol/events.js on lines 43..52
          lib/protocol/events.js on lines 65..74
          lib/protocol/events.js on lines 76..85
          lib/protocol/events.js on lines 87..96
          lib/protocol/events.js on lines 98..106
          lib/protocol/events.js on lines 108..116
          lib/protocol/events.js on lines 118..127
          lib/protocol/events.js on lines 129..138

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

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

              EventsProtocol.prototype.subscribeHttpResponse = function (nodeId, callback) {
                  assert.isMongoId(nodeId);
                  assert.func(callback);
          
                  return messenger.subscribe(
          Severity: Major
          Found in lib/protocol/events.js and 9 other locations - About 2 hrs to fix
          lib/protocol/events.js on lines 32..41
          lib/protocol/events.js on lines 43..52
          lib/protocol/events.js on lines 54..63
          lib/protocol/events.js on lines 65..74
          lib/protocol/events.js on lines 76..85
          lib/protocol/events.js on lines 98..106
          lib/protocol/events.js on lines 108..116
          lib/protocol/events.js on lines 118..127
          lib/protocol/events.js on lines 129..138

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

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

              EventsProtocol.prototype.subscribeHttpResponseUuid = function (id, callback) {
                  assert.uuid(id);
                  assert.func(callback);
                  return messenger.subscribe(
                      Constants.Protocol.Exchanges.Events.Name,
          Severity: Major
          Found in lib/protocol/events.js and 9 other locations - About 2 hrs to fix
          lib/protocol/events.js on lines 32..41
          lib/protocol/events.js on lines 43..52
          lib/protocol/events.js on lines 54..63
          lib/protocol/events.js on lines 65..74
          lib/protocol/events.js on lines 76..85
          lib/protocol/events.js on lines 87..96
          lib/protocol/events.js on lines 98..106
          lib/protocol/events.js on lines 118..127
          lib/protocol/events.js on lines 129..138

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

          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.subscribeTaskFinished = function (domain, callback) {
                  assert.string(domain);
                  assert.func(callback);
          
                  return messenger.subscribe(
          Severity: Major
          Found in lib/protocol/events.js and 1 other location - About 2 hrs to fix
          lib/protocol/task.js on lines 32..41

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

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

              EventsProtocol.prototype.publishHttpResponseUuid = function (id, data) {
                  assert.string(id);
                  assert.object(data);
                  return messenger.publish(
                      Constants.Protocol.Exchanges.Events.Name,
          Severity: Major
          Found in lib/protocol/events.js and 9 other locations - About 2 hrs to fix
          lib/protocol/events.js on lines 32..41
          lib/protocol/events.js on lines 43..52
          lib/protocol/events.js on lines 54..63
          lib/protocol/events.js on lines 65..74
          lib/protocol/events.js on lines 76..85
          lib/protocol/events.js on lines 87..96
          lib/protocol/events.js on lines 108..116
          lib/protocol/events.js on lines 118..127
          lib/protocol/events.js on lines 129..138

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

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

              EventsProtocol.prototype.publishTftpSuccess = function (nodeId, data) {
                  assert.string(nodeId);
                  assert.object(data);
          
                  return messenger.publish(
          Severity: Major
          Found in lib/protocol/events.js and 9 other locations - About 2 hrs to fix
          lib/protocol/events.js on lines 43..52
          lib/protocol/events.js on lines 54..63
          lib/protocol/events.js on lines 65..74
          lib/protocol/events.js on lines 76..85
          lib/protocol/events.js on lines 87..96
          lib/protocol/events.js on lines 98..106
          lib/protocol/events.js on lines 108..116
          lib/protocol/events.js on lines 118..127
          lib/protocol/events.js on lines 129..138

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

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

              EventsProtocol.prototype.subscribeDhcpBoundLease = function (nodeId, callback) {
                  assert.isMongoId(nodeId);
                  assert.func(callback);
          
                  return messenger.subscribe(
          Severity: Major
          Found in lib/protocol/events.js and 9 other locations - About 2 hrs to fix
          lib/protocol/events.js on lines 32..41
          lib/protocol/events.js on lines 43..52
          lib/protocol/events.js on lines 54..63
          lib/protocol/events.js on lines 65..74
          lib/protocol/events.js on lines 76..85
          lib/protocol/events.js on lines 87..96
          lib/protocol/events.js on lines 98..106
          lib/protocol/events.js on lines 108..116
          lib/protocol/events.js on lines 118..127

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

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

              EventsProtocol.prototype.subscribeTftpSuccess = function (nodeId, callback) {
                  assert.isMongoId(nodeId);
                  assert.func(callback);
          
                  return messenger.subscribe(
          Severity: Major
          Found in lib/protocol/events.js and 9 other locations - About 2 hrs to fix
          lib/protocol/events.js on lines 32..41
          lib/protocol/events.js on lines 54..63
          lib/protocol/events.js on lines 65..74
          lib/protocol/events.js on lines 76..85
          lib/protocol/events.js on lines 87..96
          lib/protocol/events.js on lines 98..106
          lib/protocol/events.js on lines 108..116
          lib/protocol/events.js on lines 118..127
          lib/protocol/events.js on lines 129..138

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

          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.subscribeNodeNotification = function (nodeId, callback) {
                  assert.func(callback);
          
                  return messenger.subscribe(
                      Constants.Protocol.Exchanges.Events.Name,
          Severity: Major
          Found in lib/protocol/events.js and 1 other location - About 1 hr to fix
          lib/protocol/task-graph-runner.js on lines 241..249

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

          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

              EventsProtocol.prototype.publishBlockedEventLoop = function (e) {
                  return messenger.publish(
                      Constants.Protocol.Exchanges.Events.Name,
                      Constants.Events.Blocked,
                      e
          Severity: Major
          Found in lib/protocol/events.js and 2 other locations - About 1 hr to fix
          lib/protocol/events.js on lines 290..296
          lib/protocol/events.js on lines 298..304

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

          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

              EventsProtocol.prototype.publishIgnoredError = function (error) {
                  return messenger.publish(
                      Constants.Protocol.Exchanges.Events.Name,
                      Constants.Events.Ignored,
                      error
          Severity: Major
          Found in lib/protocol/events.js and 2 other locations - About 1 hr to fix
          lib/protocol/events.js on lines 298..304
          lib/protocol/events.js on lines 306..312

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

          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

              EventsProtocol.prototype.publishUnhandledError = function (error) {
                  return messenger.publish(
                      Constants.Protocol.Exchanges.Events.Name,
                      Constants.Events.Unhandled,
                      error
          Severity: Major
          Found in lib/protocol/events.js and 2 other locations - About 1 hr to fix
          lib/protocol/events.js on lines 290..296
          lib/protocol/events.js on lines 306..312

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

          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

          There are no issues that match your filters.

          Category
          Status