RackHD/on-tasks

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

Summary

Maintainability
F
4 days
Test Coverage

Function UcsDiscoveryJobFactory has 178 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Function createServers has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        UcsDiscoveryJob.prototype.createServers = function (root) {
            var self = this;
            var url = "/chassis";
            return Promise.try(function () {
                if (!_.has(root, 'Chassis')) {
    Severity: Minor
    Found in lib/jobs/ucs-discovery.js - About 1 hr to fix

      Function createNode has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

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

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

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

          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

              UcsDiscoveryJob.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-discovery.js and 1 other location - About 3 hrs to fix
          lib/jobs/ucs-service-profile-discovery.js on lines 142..151

          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

              UcsDiscoveryJob.prototype.getRoot = function () {
                  var url= "/sys";
                  return this.ucs.clientRequest(url)
                      .then(function(response) {
                          return response.body;
          Severity: Major
          Found in lib/jobs/ucs-discovery.js and 2 other locations - About 1 hr to fix
          lib/jobs/ucs-discovery.js on lines 108..114
          lib/jobs/ucs-service-profile-discovery.js on lines 99..105

          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

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

              UcsDiscoveryJob.prototype.logIn = function () {
                  var url = "/login";
                  return this.ucs.clientRequest(url)
                      .then(function(response) {
                          return response.body;
          Severity: Major
          Found in lib/jobs/ucs-discovery.js and 2 other locations - About 1 hr to fix
          lib/jobs/ucs-discovery.js on lines 121..127
          lib/jobs/ucs-service-profile-discovery.js on lines 99..105

          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-discovery.js and 1 other location - About 1 hr to fix
          lib/jobs/ucs-service-profile-discovery.js on lines 173..185

          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-discovery.js and 2 other locations - About 45 mins to fix
          lib/jobs/ucs-discovery.js on lines 138..145
          lib/jobs/ucs-service-profile-discovery.js on lines 116..124

          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

          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-discovery.js and 2 other locations - About 45 mins to fix
          lib/jobs/ucs-discovery.js on lines 165..194
          lib/jobs/ucs-service-profile-discovery.js on lines 116..124

          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