RackHD/on-tasks

View on GitHub
lib/utils/job-utils/racadm-tool.js

Summary

Maintainability
F
4 days
Test Coverage

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

    function racadmFactory(
        Promise,
        parser,
        ChildProcess,
        assert,
    Severity: Minor
    Found in lib/utils/job-utils/racadm-tool.js - About 4 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

    File racadm-tool.js has 342 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Copyright 2016, EMC, Inc.
    
    'use strict';
    
    var di = require('di');
    Severity: Minor
    Found in lib/utils/job-utils/racadm-tool.js - About 4 hrs to fix

      Function updateFirmware has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          RacadmTool.prototype.updateFirmware = function(host, user, password, config) {
              var command = '', cifsUser, cifsPassword, self = this, rebootFlag;
              config = config || {};
              if (!config.filePath){
                  return Promise.reject(
      Severity: Minor
      Found in lib/utils/job-utils/racadm-tool.js - About 1 hr to fix

        Function getBiosConfig has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            RacadmTool.prototype.getBiosConfig = function(host, user, password, config, device) {
                var self =  this;
                var FILEPATH = '/tmp/configure.xml'; //root authority required
                var command = '', fqdd, cifsUser, cifsPassword, fileStoredPath;
                config = config || {};
        Severity: Minor
        Found in lib/utils/job-utils/racadm-tool.js - About 1 hr to fix

          Function _configBiosAttr has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              RacadmTool.prototype._configBiosAttr = function(host, user, password, reboot, cmd) {
                  var self = this;
                  return self.runCommand(host, user, password, cmd)
                      .then(function(){
                          return self.getSoftwareList(host, user, password);
          Severity: Minor
          Found in lib/utils/job-utils/racadm-tool.js - About 1 hr to fix

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

                RacadmTool.prototype.setBiosConfig = function(host, user, password, config) {
                    var command ='', cifsUser, cifsPassword, rebootFlag, self = this;
                    config = config || {};
                    if (!config.filePath){
                        return Promise.reject(
            Severity: Minor
            Found in lib/utils/job-utils/racadm-tool.js - About 1 hr to fix

              Function racadmFactory has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  Promise,
                  parser,
                  ChildProcess,
                  assert,
                  _,
              Severity: Major
              Found in lib/utils/job-utils/racadm-tool.js - About 1 hr to fix

                Function runAsyncCommands has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    RacadmTool.prototype.runAsyncCommands = function(host, user, password, command, count, delay) {
                Severity: Minor
                Found in lib/utils/job-utils/racadm-tool.js - About 45 mins to fix

                  Function waitJobDone has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      RacadmTool.prototype.waitJobDone = function(host, user, password, jobId, retryCount, delay) {
                  Severity: Minor
                  Found in lib/utils/job-utils/racadm-tool.js - About 45 mins to fix

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

                        RacadmTool.prototype.getBiosConfig = function(host, user, password, config, device) {
                    Severity: Minor
                    Found in lib/utils/job-utils/racadm-tool.js - About 35 mins to fix

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

                          RacadmTool.prototype._configBiosAttr = function(host, user, password, reboot, cmd) {
                      Severity: Minor
                      Found in lib/utils/job-utils/racadm-tool.js - About 35 mins to fix

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

                            RacadmTool.prototype.enableVTx = function(host, user, password, config) {
                                var cmd = "set BIOS.ProcSettings.ProcVirtualization Enabled"; 
                                var rebootFlag = config.forceReboot;
                                return this._configBiosAttr(host, user, password, rebootFlag, cmd);
                            };
                        Severity: Major
                        Found in lib/utils/job-utils/racadm-tool.js and 1 other location - About 1 hr to fix
                        lib/utils/job-utils/racadm-tool.js on lines 486..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 61.

                        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

                            RacadmTool.prototype.disableVTx = function(host, user, password, config) {
                                var cmd = "set BIOS.ProcSettings.ProcVirtualization Disabled"; 
                                var rebootFlag = config.forceReboot;
                                return this._configBiosAttr(host, user, password, rebootFlag, cmd);
                            };
                        Severity: Major
                        Found in lib/utils/job-utils/racadm-tool.js and 1 other location - About 1 hr to fix
                        lib/utils/job-utils/racadm-tool.js on lines 501..505

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

                        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

                                        if (typeof softwareList.data.BIOS === "undefined" ||
                                            typeof softwareList.data.BIOS.FQDD === "undefined"){
                                            throw new Error('Can not get BIOS FQDD');
                                        }
                        Severity: Minor
                        Found in lib/utils/job-utils/racadm-tool.js and 1 other location - About 45 mins to fix
                        lib/utils/job-utils/racadm-tool.js on lines 450..453

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

                        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

                                        if (typeof softwareList.data.BIOS === "undefined" ||
                                            typeof softwareList.data.BIOS.FQDD === "undefined"){
                                            throw new Error ('Can not get BIOS FQDD');
                                        }
                        Severity: Minor
                        Found in lib/utils/job-utils/racadm-tool.js and 1 other location - About 45 mins to fix
                        lib/utils/job-utils/racadm-tool.js on lines 330..333

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

                        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 (fileInfo.style === 'remote') {
                                    command = "update -f " + fileInfo.name + " -u " +
                                        cifsUser + " -p " + cifsPassword + " -l " + fileInfo.path;
                                } else { // 'local'
                                    command = "update -f " + fileInfo.path + "/" + fileInfo.name;
                        Severity: Minor
                        Found in lib/utils/job-utils/racadm-tool.js and 1 other location - About 35 mins to fix
                        lib/utils/job-utils/racadm-tool.js on lines 207..212

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

                        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 (fileInfo.style === 'remote') {
                                    command = "set -f " + fileInfo.name + " -t xml -u " +
                                        cifsUser + " -p " + cifsPassword + " -l " + fileInfo.path;
                                } else { // 'local'
                                    command = "set -f " + fileInfo.path + "/" + fileInfo.name + " -t xml";
                        Severity: Minor
                        Found in lib/utils/job-utils/racadm-tool.js and 1 other location - About 35 mins to fix
                        lib/utils/job-utils/racadm-tool.js on lines 259..264

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

                        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