RackHD/on-tasks

View on GitHub

Showing 1,093 of 1,093 total issues

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

    IpmiCatalogJob.prototype.handleResponse = function(result) {
        var self = this;

        return parser.parseTasks(result)
        .spread(function() {
Severity: Major
Found in lib/jobs/ipmi-catalog.js and 1 other location - About 1 day to fix
lib/jobs/local-catalog.js on lines 137..175

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

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

Function racadmFactory has 315 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function racadmFactory(
    Promise,
    parser,
    ChildProcess,
    assert,
Severity: Major
Found in lib/utils/job-utils/racadm-tool.js - About 1 day to fix

    Function snmpJobFactory has 305 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function snmpJobFactory(
        BaseJob,
        SnmpTool,
        Constants,
        Logger,
    Severity: Major
    Found in lib/jobs/snmp-job.js - About 1 day to fix

      Function ipmiJobFactory has 293 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function ipmiJobFactory(
          BaseJob,
          ipmitool,
          parser,
          Logger,
      Severity: Major
      Found in lib/jobs/ipmi-job.js - About 1 day 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

        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 obmServiceFactory has 262 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function obmServiceFactory(
              Promise,
              _,
              injector,
              assert,
          Severity: Major
          Found in lib/services/obm-service.js - About 1 day to fix

            Function DellWsmanDiscoveryJobFactory has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
            Open

            function DellWsmanDiscoveryJobFactory(
                BaseJob,
                WsmanTool,
                Logger,
                Promise,
            Severity: Minor
            Found in lib/jobs/dell-wsman-discovery.js - About 1 day 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 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 snmpPduPowerMetricFactory has 254 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function snmpPduPowerMetricFactory(
                  BaseMetric,
                  assert,
                  util,
                  _,
              Severity: Major
              Found in lib/utils/metrics/snmp-pdu-power-status.js - About 1 day to fix

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

                        return self.redfish.setup(nodeId)
                        .then(function() {
                            return self.redfish.clientRequest(self.redfish.settings.root);
                        })
                        .then(function(res) {
                Severity: Major
                Found in lib/jobs/emc-redfish-catalog.js and 1 other location - About 1 day to fix
                lib/jobs/emc-redfish-catalog.js on lines 220..266

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

                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.setup(nodeId)
                        .then(function() {
                            return self.redfish.clientRequest(self.redfish.settings.root);
                        })
                        .then(function(res) {
                Severity: Major
                Found in lib/jobs/emc-redfish-catalog.js and 1 other location - About 1 day to fix
                lib/jobs/emc-redfish-catalog.js on lines 155..197

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

                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

                File base-job.js has 574 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                // Copyright 2015, EMC, Inc.
                
                'use strict';
                
                var di = require('di');
                Severity: Major
                Found in lib/jobs/base-job.js - About 1 day to fix

                  Function WsmanSimpleFirmwareUpdateJobFactory has 241 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function WsmanSimpleFirmwareUpdateJobFactory(
                      BaseJob,
                      WsmanTool,
                      Logger,
                      util,
                  Severity: Major
                  Found in lib/jobs/dell-wsman-simple-update-firmware.js - About 1 day to fix

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

                        BaseJob.prototype._runIpmiCommandCallback = function(callback, data) {
                            var self = this;
                    
                            if (!data) {
                                return;
                    Severity: Major
                    Found in lib/jobs/base-job.js and 1 other location - About 1 day to fix
                    lib/jobs/base-job.js on lines 279..305

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

                    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

                        BaseJob.prototype._runSnmpCommandCallback = function(callback, data) {
                            var self = this;
                    
                            if (!data) {
                                return;
                    Severity: Major
                    Found in lib/jobs/base-job.js and 1 other location - About 1 day to fix
                    lib/jobs/base-job.js on lines 405..431

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

                    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

                    Function snmpJobFactory has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function snmpJobFactory(
                        BaseJob,
                        SnmpTool,
                        Constants,
                        Logger,
                    Severity: Minor
                    Found in lib/jobs/snmp-job.js - About 1 day 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 searchCatalogDataFactory has 227 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function searchCatalogDataFactory(
                        assert,
                        _,
                        waterline,
                        Promise
                    Severity: Major
                    Found in lib/utils/job-utils/catalog-searcher.js - About 1 day to fix

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

                              return this.redfish.clientRequest(rootPath)
                              .then(function(root) {
                                  if (!_.has(root.body, redfishType)) {
                                      logger.warning('No ' + redfishType + ' Members Found');
                                      return Promise.resolve();
                      Severity: Major
                      Found in lib/jobs/dell-wsman-discovery.js and 1 other location - About 1 day to fix
                      lib/jobs/dell-wsman-post-discovery.js on lines 221..244

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language