RackHD/on-tasks

View on GitHub
lib/jobs/dell-wsman-import-scp.js

Summary

Maintainability
D
2 days
Test Coverage

Function DellWsmanImportSCPJobFactory has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function DellWsmanImportSCPJobFactory(
    BaseJob,
    WsmanTool,
    Logger,
    Promise,
Severity: Major
Found in lib/jobs/dell-wsman-import-scp.js - About 2 hrs to fix

    Function DellWsmanImportSCPJobFactory has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function DellWsmanImportSCPJobFactory(
        BaseJob,
        WsmanTool,
        Logger,
        Promise,
    Severity: Minor
    Found in lib/jobs/dell-wsman-import-scp.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 DellWsmanImportSCPJobFactory has 12 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        BaseJob,
        WsmanTool,
        Logger,
        Promise,
        assert,
    Severity: Major
    Found in lib/jobs/dell-wsman-import-scp.js - About 1 hr to fix

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

          DellWsmanImportSCPJob.prototype.importSCP = function(obm) {
              if (!validator.isIP(this.options.serverIP) || !validator.isIP(this.options.shareAddress)) {
                  throw new Error('Invalid ServerIP/ShareAddress');
              }
              var self = this;
      Severity: Major
      Found in lib/jobs/dell-wsman-import-scp.js and 1 other location - About 1 day to fix
      lib/jobs/dell-wsman-export-scp.js on lines 82..100

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

      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

          DellWsmanImportSCPJob.prototype._initJob = function() {
              var self = this;
              self.dell = configuration.get('dell');
      
              if (!self.dell || !self.dell.services || !self.dell.services.configuration) {
      Severity: Major
      Found in lib/jobs/dell-wsman-import-scp.js and 1 other location - About 3 hrs to fix
      lib/jobs/dell-wsman-configure-bios.js on lines 48..54

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

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

          function DellWsmanImportSCPJob(options, context, taskId) {
              DellWsmanImportSCPJob.super_.call(this, logger, options, context, taskId);
              assert.object(this.options);
              this.nodeId = this.context.target;
          }
      Severity: Major
      Found in lib/jobs/dell-wsman-import-scp.js and 9 other locations - About 1 hr to fix
      lib/jobs/dell-wsman-RAID.js on lines 38..42
      lib/jobs/dell-wsman-add-volume-updateXml.js on lines 32..36
      lib/jobs/dell-wsman-configure-bios.js on lines 40..44
      lib/jobs/dell-wsman-configure-redfish-alert.js on lines 38..42
      lib/jobs/dell-wsman-delete-volume-updateXml.js on lines 32..36
      lib/jobs/dell-wsman-export-scp.js on lines 40..44
      lib/jobs/dell-wsman-get-systemcomponents.js on lines 38..42
      lib/jobs/dell-wsman-getXml.js on lines 35..39
      lib/jobs/dell-wsman-update-systemcomponents.js on lines 41..45

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

      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

          DellWsmanImportSCPJob.prototype._handleSyncRequest = function() {
              var self = this;
              return self.checkOBM('SCP Import')
              .then(function(obm){
                  return self.importSCP(obm);
      Severity: Major
      Found in lib/jobs/dell-wsman-import-scp.js and 2 other locations - About 1 hr to fix
      lib/jobs/dell-wsman-configure-bios.js on lines 56..62
      lib/jobs/dell-wsman-export-scp.js on lines 57..63

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

      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