RackHD/on-tasks

View on GitHub
lib/jobs/redfish-discovery-list.js

Summary

Maintainability
F
2 wks
Test Coverage

Function RedfishDiscoveryListJobFactory has 601 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function RedfishDiscoveryListJobFactory(
    eventsProtocol,
    BaseJob,
    Logger,
    Promise,
Severity: Major
Found in lib/jobs/redfish-discovery-list.js - About 3 days to fix

    File redfish-discovery-list.js has 632 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Copyright 2017, Dell EMC, Inc.
    
    'use strict';
    
    var di = require('di'),
    Severity: Major
    Found in lib/jobs/redfish-discovery-list.js - About 1 day to fix

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

          RedfishDiscoveryListJob.prototype.createSystems = function (root, redfish) {
              var self = this;
      
              if (!_.has(root, 'Systems')) {
                  logger.warning('No System Members Found');
      Severity: Major
      Found in lib/jobs/redfish-discovery-list.js - About 3 hrs to fix

        Function createChassis has 96 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            RedfishDiscoveryListJob.prototype.createChassis = function (root, redfish) {
                var self = this;
                var createEnclosure = true;
        
                if (!_.has(root, 'Chassis')) {
        Severity: Major
        Found in lib/jobs/redfish-discovery-list.js - About 3 hrs to fix

          Function discoverList has 84 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              RedfishDiscoveryListJob.prototype.discoverList = function (endpoint) {
                  var self = this;
          
                  assert.object(endpoint);
                  assert.string(endpoint.uri);
          Severity: Major
          Found in lib/jobs/redfish-discovery-list.js - About 3 hrs to fix

            Function RedfishDiscoveryListJobFactory has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

            function RedfishDiscoveryListJobFactory(
                eventsProtocol,
                BaseJob,
                Logger,
                Promise,
            Severity: Minor
            Found in lib/jobs/redfish-discovery-list.js - About 2 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 createManagers has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                RedfishDiscoveryListJob.prototype.createManagers = function (root, redfish) {
                    var self = this;
            
                    if (!_.has(root, 'Managers')) {
                        throw new Error('No Manager Members Found');
            Severity: Major
            Found in lib/jobs/redfish-discovery-list.js - About 2 hrs to fix

              Function createNetwork has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  RedfishDiscoveryListJob.prototype.createNetwork = function (root, redfish) {
                      var self = this;
              
                      if (!_.has(root, 'NetworkDevices')) {
                          logger.warning('No NetworkDevices Members Found');
              Severity: Major
              Found in lib/jobs/redfish-discovery-list.js - About 2 hrs to fix

                Function createRedfishNode has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    RedfishDiscoveryListJob.prototype.createRedfishNode = function (
                        root,
                        resourceName,
                        resourceTypes,
                        nodeType,
                Severity: Major
                Found in lib/jobs/redfish-discovery-list.js - About 2 hrs to fix

                  Function mapPathToIdRelation has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      RedfishDiscoveryListJob.prototype.mapPathToIdRelation = function (src, target, type) {
                          var self = this;
                          if(src === undefined || src === [] || target === undefined || target === [])
                          {
                              return;
                  Severity: Minor
                  Found in lib/jobs/redfish-discovery-list.js - About 1 hr to fix

                    Function upsertRelations has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        RedfishDiscoveryListJob.prototype.upsertRelations = function(node, relations) {
                            //todo fix this hack to allow mulitple nodes to be created
                            var lookup;
                            if ( 'identifiers' in node )
                            {
                    Severity: Minor
                    Found in lib/jobs/redfish-discovery-list.js - About 1 hr to fix

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

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

                        Function createRedfishNode has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                root,
                                resourceName,
                                resourceTypes,
                                nodeType,
                                redfish) {
                        Severity: Minor
                        Found in lib/jobs/redfish-discovery-list.js - About 35 mins to fix

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

                                          return self.upsertRelations(node, relations)
                                          .then(function(n) {
                                              var config = Object.assign({}, redfish.settings);
                                              config.root = data.manager['@odata.id'];
                          
                          
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 2 other locations - About 4 hrs to fix
                          lib/jobs/redfish-discovery-list.js on lines 402..415
                          lib/jobs/redfish-discovery.js on lines 186..200

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

                          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.upsertRelations(node, relations)
                                          .then(function(n) {
                                              var config = Object.assign({}, redfish.settings);
                                              config.root = data.chassis['@odata.id'];
                          
                          
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 2 other locations - About 4 hrs to fix
                          lib/jobs/redfish-discovery-list.js on lines 604..617
                          lib/jobs/redfish-discovery.js on lines 186..200

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

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

                                  return Promise.resolve(self.restRequest(redfish.settings, root.Managers['@odata.id']))
                                  .then(function(res) {
                                      assert.object(res);
                                      return res.body.Members;
                                  })
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 4 other locations - About 3 hrs to fix
                          lib/jobs/redfish-discovery-list.js on lines 246..297
                          lib/jobs/redfish-discovery-list.js on lines 315..342
                          lib/jobs/redfish-discovery-list.js on lines 437..458
                          lib/jobs/redfish-discovery-list.js on lines 641..663

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

                                  return Promise.resolve(self.restRequest(redfish.settings, root[resourceName]['@odata.id']))
                                      .then(function(res) {
                                          assert.object(res);
                                          return res.body.Members;
                                      })
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 4 other locations - About 3 hrs to fix
                          lib/jobs/redfish-discovery-list.js on lines 315..342
                          lib/jobs/redfish-discovery-list.js on lines 437..458
                          lib/jobs/redfish-discovery-list.js on lines 547..569
                          lib/jobs/redfish-discovery-list.js on lines 641..663

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

                                  return Promise.resolve(self.restRequest(redfish.settings, root.Chassis['@odata.id']))
                                  .then(function(res) {
                                      assert.object(res);
                                      return res.body.Members;
                                  })
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 4 other locations - About 3 hrs to fix
                          lib/jobs/redfish-discovery-list.js on lines 246..297
                          lib/jobs/redfish-discovery-list.js on lines 437..458
                          lib/jobs/redfish-discovery-list.js on lines 547..569
                          lib/jobs/redfish-discovery-list.js on lines 641..663

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

                                  return Promise.resolve(self.restRequest(redfish.settings, root.Systems['@odata.id']))
                                  .then(function(res) {
                                      assert.object(res);
                                      return res.body.Members;
                                  })
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 4 other locations - About 3 hrs to fix
                          lib/jobs/redfish-discovery-list.js on lines 246..297
                          lib/jobs/redfish-discovery-list.js on lines 315..342
                          lib/jobs/redfish-discovery-list.js on lines 547..569
                          lib/jobs/redfish-discovery-list.js on lines 641..663

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

                                  return Promise.resolve(self.restRequest(redfish.settings, root.NetworkDevices['@odata.id']))
                                      .then(function(res) {
                                          assert.object(res);
                                          return res.body.Members;
                                      })
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 4 other locations - About 3 hrs to fix
                          lib/jobs/redfish-discovery-list.js on lines 246..297
                          lib/jobs/redfish-discovery-list.js on lines 315..342
                          lib/jobs/redfish-discovery-list.js on lines 437..458
                          lib/jobs/redfish-discovery-list.js on lines 547..569

                          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

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

                               RedfishDiscoveryListJob.prototype.restRequest = function(settings, path) {
                                  var url = settings.protocol + '://' + settings.host + ':' + settings.port + path;
                                  return request.get(url, {
                                     'auth': {
                                          'user': settings.username || '',
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 1 other location - About 3 hrs to fix
                          lib/jobs/general-redfish-catalog.js on lines 90..100

                          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

                                          if (cooling) {
                                              _.forEach(cooling[0], function (coolingType) {
                                                  self.context.cooling = (self.context.cooling || []).concat(_.map(coolingType,
                                                      function (it) {
                                                      return _.get(it, 'id');
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 1 other location - About 2 hrs to fix
                          lib/jobs/redfish-discovery-list.js on lines 159..165

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

                          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

                                          if (power) {
                                              _.forEach(power[0], function (powerType) {
                                                  self.context.power = (self.context.power || []).concat(_.map(powerType, function (it) {
                                                      return _.get(it, 'id');
                                                  }));
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 1 other location - About 2 hrs to fix
                          lib/jobs/redfish-discovery-list.js on lines 151..158

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

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

                                          _.forEach(data.chassisCollection, function(chassisUrl) {
                                              var target = _.get(chassisUrl, '@odata.id') ||
                                                           _.get(chassisUrl, 'href');
                                              if (!_.isUndefined(target)) {
                                                  targetList.push(target);
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 3 other locations - About 2 hrs to fix
                          lib/jobs/redfish-discovery-list.js on lines 371..377
                          lib/jobs/redfish-discovery-list.js on lines 574..580
                          lib/jobs/redfish-discovery-list.js on lines 582..588

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

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

                                          _.forEach(data.systems, function(sys) {
                                              var target = _.get(sys, '@odata.id') ||
                                                           _.get(sys, 'href');
                                              if (!_.isUndefined(target)) {
                                                  targetList.push(target);
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 3 other locations - About 2 hrs to fix
                          lib/jobs/redfish-discovery-list.js on lines 379..385
                          lib/jobs/redfish-discovery-list.js on lines 574..580
                          lib/jobs/redfish-discovery-list.js on lines 582..588

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

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

                                          _.forEach(data.systems, function(systemUrl) {
                                              var target = _.get(systemUrl, '@odata.id') ||
                                                           _.get(systemUrl, 'href');
                                              if (!_.isUndefined(target)) {
                                                  targetList.push(target);
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 3 other locations - About 2 hrs to fix
                          lib/jobs/redfish-discovery-list.js on lines 371..377
                          lib/jobs/redfish-discovery-list.js on lines 379..385
                          lib/jobs/redfish-discovery-list.js on lines 582..588

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

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

                                          _.forEach(data.chassis, function(chassisUrl) {
                                              var target = _.get(chassisUrl, '@odata.id') ||
                                                           _.get(chassisUrl, 'href');
                                              if (!_.isUndefined(target)) {
                                                  targetList.push(target);
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 3 other locations - About 2 hrs to fix
                          lib/jobs/redfish-discovery-list.js on lines 371..377
                          lib/jobs/redfish-discovery-list.js on lines 379..385
                          lib/jobs/redfish-discovery-list.js on lines 574..580

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

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

                                          return self.upsertRelations(node, relations)
                                              .then(function(nodeRecord) {
                                                  return Promise.all([
                                                      waterline.obms.upsertByNode(nodeRecord.id, obm),
                                                      nodeRecord
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 2 other locations - About 2 hrs to fix
                          lib/jobs/redfish-discovery-list.js on lines 523..532
                          lib/jobs/redfish-discovery.js on lines 298..307

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

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

                                          return self.upsertRelations(node, relations)
                                          .then(function(nodeRecord) {
                                              return Promise.all([
                                                  waterline.obms.upsertByNode(nodeRecord.id, obm),
                                                  nodeRecord
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 2 other locations - About 2 hrs to fix
                          lib/jobs/redfish-discovery-list.js on lines 692..701
                          lib/jobs/redfish-discovery.js on lines 298..307

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

                          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 Promise.resolve(self.restRequest(redfish.settings, chassis['@odata.id']))
                                          .then(function(res) {
                                              if (res.body.id !== data.system.id || res.body.SerialNumber !== data.system.SerialNumber) {
                                                  createEnclosure = true;
                                              }
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 1 other location - About 1 hr to fix
                          lib/jobs/redfish-discovery-list.js on lines 347..353

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

                          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 Promise.resolve(self.restRequest(redfish.settings, systemUrl))
                                          .then(function(res) {
                          
                                              if (res.body.Id === data.chassis.Id && res.body.SerialNumber === data.chassis.SerialNumber) {
                                                  createEnclosure = false;
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 1 other location - About 1 hr to fix
                          lib/jobs/redfish-discovery-list.js on lines 476..481

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

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

                                      _.forEach(data.chassis, function(chassis) {
                                          var target = _.get(chassis, '@odata.id') ||
                                                       _.get(chassis, 'href');
                                          targetList.push(target);
                                      });
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 4 other locations - About 1 hr to fix
                          lib/jobs/redfish-discovery-list.js on lines 469..473
                          lib/jobs/redfish-discovery-list.js on lines 668..672
                          lib/jobs/redfish-discovery.js on lines 169..173
                          lib/jobs/redfish-discovery.js on lines 243..247

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

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

                                      _.forEach(data.managers, function(manager) {
                                          var target = _.get(manager, '@odata.id') ||
                                                       _.get(manager, 'href');
                                          managedByList.push(target);
                                      });
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 4 other locations - About 1 hr to fix
                          lib/jobs/redfish-discovery-list.js on lines 464..468
                          lib/jobs/redfish-discovery-list.js on lines 668..672
                          lib/jobs/redfish-discovery.js on lines 169..173
                          lib/jobs/redfish-discovery.js on lines 243..247

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

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

                                          _.forEach(data.chassis, function(chassis) {
                                              var target = _.get(chassis, '@odata.id') ||
                                                  _.get(chassis, 'href');
                                              targetList.push(target);
                                          });
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 4 other locations - About 1 hr to fix
                          lib/jobs/redfish-discovery-list.js on lines 464..468
                          lib/jobs/redfish-discovery-list.js on lines 469..473
                          lib/jobs/redfish-discovery.js on lines 169..173
                          lib/jobs/redfish-discovery.js on lines 243..247

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

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

                                          var nodeRoot = redfish.settings.protocol + "://" +
                                              redfish.settings.host + ":" + redfish.settings.port + data.system['@odata.id'];
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 3 other locations - About 1 hr to fix
                          lib/jobs/redfish-discovery-list.js on lines 387..388
                          lib/jobs/redfish-discovery-list.js on lines 590..591
                          lib/jobs/redfish-discovery-list.js on lines 676..677

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

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

                                          var nodeRoot = redfish.settings.protocol + "://" +
                                              redfish.settings.host + ":" + redfish.settings.port + data.chassis['@odata.id'];
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 3 other locations - About 1 hr to fix
                          lib/jobs/redfish-discovery-list.js on lines 487..488
                          lib/jobs/redfish-discovery-list.js on lines 590..591
                          lib/jobs/redfish-discovery-list.js on lines 676..677

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

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

                                          var nodeRoot = redfish.settings.protocol + "://" +
                                              redfish.settings.host + ":" + redfish.settings.port + data.network['@odata.id'];
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 3 other locations - About 1 hr to fix
                          lib/jobs/redfish-discovery-list.js on lines 387..388
                          lib/jobs/redfish-discovery-list.js on lines 487..488
                          lib/jobs/redfish-discovery-list.js on lines 590..591

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

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

                                          var nodeRoot = redfish.settings.protocol + "://" +
                                              redfish.settings.host + ":" + redfish.settings.port + data.manager['@odata.id'];
                          Severity: Major
                          Found in lib/jobs/redfish-discovery-list.js and 3 other locations - About 1 hr to fix
                          lib/jobs/redfish-discovery-list.js on lines 387..388
                          lib/jobs/redfish-discovery-list.js on lines 487..488
                          lib/jobs/redfish-discovery-list.js on lines 676..677

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

                          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

                                      _.forEach(target, function(t) {
                                          deferredObms.push(waterline.obms.findByNode(t.id, 'redfish-obm-service'));
                                      });
                          Severity: Minor
                          Found in lib/jobs/redfish-discovery-list.js and 1 other location - About 35 mins to fix
                          lib/jobs/redfish-discovery.js on lines 328..330

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

                          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

                                              _.forEach(_.get(relations, 'targets', []), function(relation) {
                                                  if (relation === obms[i].config.root) {
                                                      ids.push(t.id);
                                                  }
                                              });
                          Severity: Minor
                          Found in lib/jobs/redfish-discovery-list.js and 1 other location - About 30 mins to fix
                          lib/jobs/redfish-discovery.js on lines 335..339

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

                          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