RackHD/on-tasks

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

Summary

Maintainability
F
1 wk
Test Coverage

Function redfishJobFactory has 441 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function redfishJobFactory(
    BaseJob,
    Logger,
    util,
    assert,
Severity: Major
Found in lib/jobs/redfish-job.js - About 2 days to fix

    File redfish-job.js has 469 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-job.js - About 7 hrs to fix

      Function collectData has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          RedfishJob.prototype.collectData = function(config, command) {
              var self = this;
              assert.string(command, 'Redfish Command');
              var redfish = self.initClient(config);
      
      
      Severity: Major
      Found in lib/jobs/redfish-job.js - About 3 hrs to fix

        Function run has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            RedfishJob.prototype._run = function run() {
                var self = this;
                return waterline.workitems.update({name: "Pollers.Redfish"}, {failureCount: 0})
                .then(function() {
                    self._subscribeRedfishCommand(self.routingKey, function(data) {
        Severity: Major
        Found in lib/jobs/redfish-job.js - About 2 hrs to fix

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

              RedfishJob.prototype.collectManagersLogEntries = function(redfish) {
                  var parse = urlParse(redfish.settings.uri);
                  var rootPath = parse.pathname + '/';
          
                  // Managers is a root resource
          Severity: Major
          Found in lib/jobs/redfish-job.js - About 2 hrs to fix

            Function fabricServiceDataAlert has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                RedfishJob.prototype.fabricServiceDataAlert = function(redfish, currentData) {
                    var self = this;
                    var alert = {
                        pollerName: 'FabricService',
                        data: []
            Severity: Major
            Found in lib/jobs/redfish-job.js - About 2 hrs to fix

              Function collectOemElementsData has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  RedfishJob.prototype.collectOemElementsData = function(redfish, type) {
                      var self = this;
                      var parse = urlParse(redfish.settings.root);
                      return redfish.clientRequest(parse)
                      .then(function (res) {
              Severity: Minor
              Found in lib/jobs/redfish-job.js - About 1 hr to fix

                Function redfishJobFactory has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                function redfishJobFactory(
                    BaseJob,
                    Logger,
                    util,
                    assert,
                Severity: Minor
                Found in lib/jobs/redfish-job.js - About 1 hr to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function collectSystemLogEntries has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    RedfishJob.prototype.collectSystemLogEntries = function(redfish, resource) {
                        return redfish.clientRequest(resource)
                        .then(function(res) {
                            assert.ok(_.has(res.body, 'Members'),
                                'Has LogServices Members');
                Severity: Minor
                Found in lib/jobs/redfish-job.js - About 1 hr to fix

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

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

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

                        RedfishJob.prototype.collectOemSpineData = function(redfish, type) {
                            return redfish.clientRequest().then(function(res) {
                                var spineModId = _.get(res.body, 'Oem.Emc.SpineModules', {})['@odata.id'];
                                if (_.isUndefined(spineModId)) {
                                    throw new Error('Missing SpineModules Resource');
                    Severity: Major
                    Found in lib/jobs/redfish-job.js and 1 other location - About 1 day to fix
                    lib/jobs/redfish-job.js on lines 471..490

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

                    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

                        RedfishJob.prototype.collectOemAggregatorData = function(redfish, type) {
                            return redfish.clientRequest().then(function(res) {
                                var spineModId = _.get(res.body, 'Oem.Emc.Aggregators', {})['@odata.id'];
                                if (_.isUndefined(spineModId)) {
                                    throw new Error('Missing Aggregators Resource');
                    Severity: Major
                    Found in lib/jobs/redfish-job.js and 1 other location - About 1 day to fix
                    lib/jobs/redfish-job.js on lines 445..464

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

                    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

                        RedfishJob.prototype.concurrentRequests = function(node, workItemId) {
                            assert.string(node);
                            assert.string(workItemId);
                            if(!_.has(this.concurrent, node)){
                                this.concurrent[node] = {};
                    Severity: Major
                    Found in lib/jobs/redfish-job.js and 1 other location - About 6 hrs to fix
                    lib/jobs/snmp-job.js on lines 62..76

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

                    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

                         RedfishJob.prototype.removeConcurrentRequest = function(node, type) {
                            assert.object(this.concurrent[node]);
                            assert.number(this.concurrent[node][type]);
                            this.concurrent[node][type] -= 1;
                        };
                    Severity: Major
                    Found in lib/jobs/redfish-job.js and 2 other locations - About 2 hrs to fix
                    lib/jobs/ipmi-job.js on lines 116..120
                    lib/jobs/redfish-job.js on lines 153..157

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

                    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

                        RedfishJob.prototype.addConcurrentRequest = function(node, type) {
                            assert.object(this.concurrent[node]);
                            assert.number(this.concurrent[node][type]);
                            this.concurrent[node][type] += 1;
                        };
                    Severity: Major
                    Found in lib/jobs/redfish-job.js and 2 other locations - About 2 hrs to fix
                    lib/jobs/ipmi-job.js on lines 116..120
                    lib/jobs/redfish-job.js on lines 163..167

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

                    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 redfish.clientRequest(rootPath)
                            .then(function(res) {
                                assert.ok(_.has(res.body, 'Managers'),
                                    'Managers Resource');
                                return redfish.clientRequest(res.body.Managers['@odata.id']);
                    Severity: Major
                    Found in lib/jobs/redfish-job.js and 1 other location - About 1 hr to fix
                    lib/jobs/redfish-job.js on lines 175..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 68.

                    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 redfish.clientRequest(resource)
                            .then(function(res) {
                                assert.ok(_.has(res.body, 'Members'),
                                    'Has LogServices Members');
                                return res.body.Members;
                    Severity: Major
                    Found in lib/jobs/redfish-job.js and 1 other location - About 1 hr to fix
                    lib/jobs/redfish-job.js on lines 220..265

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

                    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

                                case 'power':
                                    assert.ok(_.has(member, 'Power'),
                                        'Power Resource for ' + member.Name);
                                    return redfish.clientRequest(
                                        member.Power['@odata.id']
                    Severity: Minor
                    Found in lib/jobs/redfish-job.js and 1 other location - About 50 mins to fix
                    lib/jobs/redfish-job.js on lines 514..519

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

                    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

                                case 'thermal':
                                    assert.ok(_.has(member, 'Thermal'),
                                        'Thermal Resource for ' + member.Name);
                                    return redfish.clientRequest(
                                        member.Thermal['@odata.id']
                    Severity: Minor
                    Found in lib/jobs/redfish-job.js and 1 other location - About 50 mins to fix
                    lib/jobs/redfish-job.js on lines 508..513

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

                    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