RackHD/on-tasks

View on GitHub
lib/jobs/ucs-service-profile-discovery.js

Summary

Maintainability
F
3 days
Test Coverage

Function UcsServiceProfileDiscoveryJobFactory has 124 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function UcsServiceProfileDiscoveryJobFactory(
    BaseJob,
    Logger,
    Promise,
    assert,
Severity: Major
Found in lib/jobs/ucs-service-profile-discovery.js - About 4 hrs to fix

    Function UcsServiceProfileDiscoveryJobFactory has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        BaseJob,
        Logger,
        Promise,
        assert,
        util,
    Severity: Major
    Found in lib/jobs/ucs-service-profile-discovery.js - About 1 hr to fix

      Function createUpdateNode has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          UcsServiceProfileDiscoveryJob.prototype.createUpdateNode = function(data, type) {
      
              var self = this;
              var config = Object.assign({}, self.settings);
      
      
      Severity: Minor
      Found in lib/jobs/ucs-service-profile-discovery.js - About 1 hr to fix

        Function createServiceProfile has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            UcsServiceProfileDiscoveryJob.prototype.createServiceProfile = function (root) {
                var self = this;
                var url = "/serviceProfile";
                return Promise.try(function () {
                    if (_.has(root, 'ServiceProfile')) {
        Severity: Minor
        Found in lib/jobs/ucs-service-profile-discovery.js - About 1 hr to fix

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

              function UcsServiceProfileDiscoveryJob(options, context, taskId) {
                  UcsServiceProfileDiscoveryJob.super_.call(this,
                                             logger,
                                             options,
                                             context,
          Severity: Major
          Found in lib/jobs/ucs-service-profile-discovery.js and 1 other location - About 1 day to fix
          lib/jobs/ucs-discovery.js on lines 43..70

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

          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

              UcsServiceProfileDiscoveryJob.prototype.updateRelations = function(nodeId, relations) {
                  // Update existing node with new relations or create one
                  return waterline.nodes.needOneById(nodeId)
                      .then(function(curNode) {
                          relations = _.uniq(relations.concat(curNode.relations), 'relationType');
          Severity: Major
          Found in lib/jobs/ucs-service-profile-discovery.js and 1 other location - About 3 hrs to fix
          lib/jobs/ucs-discovery.js on lines 198..208

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

          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

              UcsServiceProfileDiscoveryJob.prototype.getRoot = function () {
                  var url = "/serviceProfile";
                  return this.ucs.clientRequest(url)
                      .then(function(response) {
                          return response.body;
          Severity: Major
          Found in lib/jobs/ucs-service-profile-discovery.js and 2 other locations - About 1 hr to fix
          lib/jobs/ucs-discovery.js on lines 108..114
          lib/jobs/ucs-discovery.js on lines 121..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 67.

          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

                  return waterline.nodes.needOne({identifiers:ids})
                      .then(function(curNode) {
                          return waterline.nodes.updateOne(
                              { id: curNode.id },
                              node
          Severity: Major
          Found in lib/jobs/ucs-service-profile-discovery.js and 1 other location - About 1 hr to fix
          lib/jobs/ucs-discovery.js on lines 234..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 64.

          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

                          return self.ucs.clientRequest(url)
                              .then(function(res) {
                                  assert.object(res);
                                  return res.body;
                              })
          Severity: Major
          Found in lib/jobs/ucs-service-profile-discovery.js and 2 other locations - About 45 mins to fix
          lib/jobs/ucs-discovery.js on lines 138..145
          lib/jobs/ucs-discovery.js on lines 165..194

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 50.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          There are no issues that match your filters.

          Category
          Status