RackHD/on-tasks

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

Summary

Maintainability
F
6 days
Test Coverage

Function RedfishDiscoveryJobFactory has 256 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function RedfishDiscoveryJobFactory(
    BaseJob,
    Logger,
    Promise,
    assert,
Severity: Major
Found in lib/jobs/redfish-discovery.js - About 1 day to fix

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

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

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

      // Copyright 2016, EMC, Inc.
      
      'use strict';
      
      var di = require('di'),
      Severity: Minor
      Found in lib/jobs/redfish-discovery.js - About 2 hrs to fix

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

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

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

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

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

                RedfishDiscoveryJob.prototype.mapPathToIdRelation = function (src, target, type) {
                    var self = this;
                    src = Array.isArray(src) ? src : [ src ];
                    target = Array.isArray(target) ? target : [ target ];
                    return Promise.resolve(src)
            Severity: Minor
            Found in lib/jobs/redfish-discovery.js - About 1 hr to fix

              Function _run has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  RedfishDiscoveryJob.prototype._run = function() {
                      var self = this;
                      
                      return self.getRoot()
                      .then(function(root) {
              Severity: Minor
              Found in lib/jobs/redfish-discovery.js - About 1 hr to fix

                Function RedfishDiscoveryJobFactory has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                function RedfishDiscoveryJobFactory(
                    BaseJob,
                    Logger,
                    Promise,
                    assert,
                Severity: Minor
                Found in lib/jobs/redfish-discovery.js - About 55 mins to fix

                Cognitive Complexity

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

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

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

                Further reading

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

                        return self.redfish.clientRequest(root.Systems['@odata.id'])
                        .then(function(res) {
                            assert.object(res);
                            return res.body.Members;
                        })
                Severity: Major
                Found in lib/jobs/redfish-discovery.js and 1 other location - About 1 day to fix
                lib/jobs/redfish-discovery.js on lines 142..201

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

                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 self.redfish.clientRequest(root.Chassis['@odata.id'])
                        .then(function(res) {
                            assert.object(res);
                            return res.body.Members;
                        })
                Severity: Major
                Found in lib/jobs/redfish-discovery.js and 1 other location - About 1 day to fix
                lib/jobs/redfish-discovery.js on lines 216..309

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

                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({}, self.settings);
                                config.root = data.chassis['@odata.id'];
                
                
                Severity: Major
                Found in lib/jobs/redfish-discovery.js and 2 other locations - About 4 hrs to fix
                lib/jobs/redfish-discovery-list.js on lines 402..415
                lib/jobs/redfish-discovery-list.js on lines 604..617

                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

                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.js and 2 other locations - About 2 hrs to fix
                lib/jobs/redfish-discovery-list.js on lines 523..532
                lib/jobs/redfish-discovery-list.js on lines 692..701

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

                            _.forEach(data.systems, function(sys) {
                                var target = _.get(sys, '@odata.id') ||
                                             _.get(sys, 'href');
                                targetList.push(target);
                            });
                Severity: Major
                Found in lib/jobs/redfish-discovery.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-list.js on lines 668..672
                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.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-list.js on lines 668..672
                lib/jobs/redfish-discovery.js on lines 169..173

                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

                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.js and 1 other location - About 35 mins to fix
                lib/jobs/redfish-discovery-list.js on lines 734..736

                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(relations.targets, function(relation) {
                                        if (relation === obms[i].config.root) {
                                            ids.push(t.id);
                                        }
                                    });
                Severity: Minor
                Found in lib/jobs/redfish-discovery.js and 1 other location - About 30 mins to fix
                lib/jobs/redfish-discovery-list.js on lines 741..745

                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