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

    function SshCatalogJob(options, context, taskId) {
        SshCatalogJob.super_.call(this, logger, options, context, taskId);
        assert.string(this.context.target);
        this.nodeId = this.context.target;
        this.commandUtil = new CommandUtil(this.nodeId);
Severity: Major
Found in lib/jobs/ssh-catalog.js and 1 other location - About 6 hrs to fix
lib/jobs/ssh-command.js on lines 34..43

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

    DellWsmanDiscoveryJob.prototype.createWsmanObm = function(node, ipAddr){

        var self = this;
        var credential = self.getCredential(ipAddr, self.credentialMapping);

Severity: Major
Found in lib/jobs/dell-wsman-discovery.js and 1 other location - About 6 hrs to fix
lib/jobs/dell-wsman-discovery.js on lines 704..718

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

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

    DellWsmanDiscoveryJob.prototype.createDefaultObm = function(node, ipAddr){

        var self = this;
        var credential = self.getCredential(ipAddr, self.credentialMapping);

Severity: Major
Found in lib/jobs/dell-wsman-discovery.js and 1 other location - About 6 hrs to fix
lib/jobs/dell-wsman-discovery.js on lines 721..735

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

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

function generateEnclosureJobFactory(
    BaseJob,
    waterline,
    catalogSearch,
    Logger,
Severity: Major
Found in lib/jobs/generate-enclosure.js - About 6 hrs to fix

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

                return waterline.catalogs.findLatestCatalogOfSource(self.nodeId, name)
                .then(function(catalog){
                    if (_.isEmpty(catalog)) {
                        logger.debug("handleAsyncResponse: Catalog (" + name + ") not found.  Creating...");
                        return waterline.catalogs.create({
    Severity: Major
    Found in lib/jobs/dell-wsman-inventory.js and 1 other location - About 5 hrs to fix
    lib/jobs/dell-wsman-bios.js on lines 156..169

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

                return waterline.catalogs.findLatestCatalogOfSource(self.nodeId, name)
                .then(function(catalog){
                    if (_.isEmpty(catalog)) {
                        logger.debug("handleAsyncResponse: Catalog (" + name + ") not found.  Creating...");
                        return waterline.catalogs.create({
    Severity: Major
    Found in lib/jobs/dell-wsman-bios.js and 1 other location - About 5 hrs to fix
    lib/jobs/dell-wsman-inventory.js on lines 163..176

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

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

    function pollerMessageCacheJobFactory(
        BaseJob,
        configuration,
        Logger,
        util,
    Severity: Major
    Found in lib/jobs/message-cache-job.js - About 5 hrs to fix

      Function RedfishObmServiceFactory has 143 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function RedfishObmServiceFactory(
          BaseObmService, 
          Promise, 
          waterline,
          assert,
      Severity: Major
      Found in lib/services/redfish-obm-service.js - About 5 hrs to fix

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

            BaseJob.prototype._subscribeWsmanCommandResult =
                function subscribeWsmanCommandResult(uuid, command, callback) {
                var self = this;
                var deferred = messenger.subscribe(
                    Constants.Protocol.Exchanges.Task.Name,
        Severity: Major
        Found in lib/jobs/base-job.js and 1 other location - About 5 hrs to fix
        lib/jobs/base-job.js on lines 527..541

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

        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._subscribeRedfishCommandResult =
                function subscribeRedfishCommandResult(uuid, command, callback) {
                var self = this;
                var deferred = messenger.subscribe(
                    Constants.Protocol.Exchanges.Task.Name,
        Severity: Major
        Found in lib/jobs/base-job.js and 1 other location - About 5 hrs to fix
        lib/jobs/base-job.js on lines 627..641

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

        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 installOsJobFactory has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

        function installOsJobFactory(
            BaseJob,
            Logger,
            assert,
            util,
        Severity: Minor
        Found in lib/jobs/install-os.js - About 5 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 waitSelEventJobFactory has 137 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function waitSelEventJobFactory(
            BaseJob,
            Logger,
            util,
            assert,
        Severity: Major
        Found in lib/jobs/wait-sel-events-job.js - About 5 hrs to fix

          File general-redfish-catalog.js has 387 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          //Copyright 2017, Dell EMC, Inc.
          'use strict';
          
          var di = require('di');
          var request = require('requestretry');
          Severity: Minor
          Found in lib/jobs/general-redfish-catalog.js - About 5 hrs to fix

            Function createDefaultPollersJobFactory has 132 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function createDefaultPollersJobFactory(
                BaseJob,
                waterline,
                Logger,
                util,
            Severity: Major
            Found in lib/jobs/create-default-pollers.js - About 5 hrs to fix

              Function parseSensorsDataFactory has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
              Open

              function parseSensorsDataFactory(assert, _) {
                  //UID status code, 0 = Off, 1 = Temporary On , 2 = On, 3 = reserved
                  var uidStatus = ['Off', 'Temporary On', 'On', 'Reserved'];
              
                  function parseSelInformationData(selData) {
              Severity: Minor
              Found in lib/utils/job-utils/ipmi-parser.js - About 5 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

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

                  BaseJob.prototype._subscribeRedfishCommand =
                      function _subscribeRedfishCommand (uuid, callback) {
                      var self = this;
                      var deferred = messenger.subscribe(
                          Constants.Protocol.Exchanges.Task.Name,
              Severity: Major
              Found in lib/jobs/base-job.js and 1 other location - About 5 hrs to fix
              lib/jobs/base-job.js on lines 593..607

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

              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._subscribeWsmanCommand =
                      function _subscribeWsmanCommand (uuid, callback) {
                      var self = this;
                      var deferred = messenger.subscribe(
                          Constants.Protocol.Exchanges.Task.Name,
              Severity: Major
              Found in lib/jobs/base-job.js and 1 other location - About 5 hrs to fix
              lib/jobs/base-job.js on lines 560..574

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

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

              function pduRelationsJobFactory(
                  BaseJob,
                  waterline,
                  Logger,
                  util,
              Severity: Major
              Found in lib/jobs/pdu-node-relations.js - About 5 hrs to fix

                Function dockerJobFactory has 130 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function dockerJobFactory(
                    BaseJob,
                    util,
                    Logger,
                    assert,
                Severity: Major
                Found in lib/jobs/docker-job.js - About 5 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language