RackHD/on-http

View on GitHub
lib/api/redfish-1.0/managers.js

Summary

Maintainability
F
5 days
Test Coverage

File managers.js has 510 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright 2016, EMC, Inc.

'use strict';

var injector = require('../../../index.js').injector;
Severity: Major
Found in lib/api/redfish-1.0/managers.js - About 1 day to fix

    Function getManager has 95 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var getManager = controller(function(req, res) {
        var identifier = req.swagger.params.identifier.value;
        var options = redfish.makeOptions(req, res, identifier);
        return redfish.getVendorNameById(identifier)
        .catch(function() {return{};})
    Severity: Major
    Found in lib/api/redfish-1.0/managers.js - About 3 hrs to fix

      Function listManagerNetworkProtocol has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var listManagerNetworkProtocol = controller(function(req, res) {
          var identifier = req.swagger.params.identifier.value;
          var options = redfish.makeOptions(req, res, identifier);
      
          return redfish.getVendorNameById(identifier)
      Severity: Major
      Found in lib/api/redfish-1.0/managers.js - About 2 hrs to fix

        Function getManagerEthernetInterface has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var getManagerEthernetInterface = controller(function(req, res) {
            var identifier = req.swagger.params.identifier.value;
            var index = req.swagger.params.index.value;
            var options = redfish.makeOptions(req, res, identifier);
        
        
        Severity: Minor
        Found in lib/api/redfish-1.0/managers.js - About 1 hr to fix

          Function getManagerSerialInterface has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var getManagerSerialInterface = controller(function (req, res) {
              var identifier = req.swagger.params.identifier.value;
              var options = redfish.makeOptions(req, res);
              var index = req.swagger.params.index.raw;
          
          
          Severity: Minor
          Found in lib/api/redfish-1.0/managers.js - About 1 hr to fix

            Function listManagerSerialInterfaces has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var listManagerSerialInterfaces = controller(function (req, res) {
                var identifier = req.swagger.params.identifier.value;
                var options = redfish.makeOptions(req, res, identifier);
            
                return redfish.getVendorNameById(identifier)
            Severity: Minor
            Found in lib/api/redfish-1.0/managers.js - About 1 hr to fix

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

              var getLocalEthernetInterface = controller(function(req, res) {
                  var options = redfish.makeOptions(req, res);
                  var index = req.swagger.params.index.value;
                  return Promise.try(function() {
                  var net = _.get(os.networkInterfaces(), index);
              Severity: Minor
              Found in lib/api/redfish-1.0/managers.js - About 1 hr to fix

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

                var listManagerEthernetInterfaces = controller(function(req, res) {
                    var identifier = req.swagger.params.identifier.value;
                    var options = redfish.makeOptions(req, res, identifier);
                
                    return redfish.getVendorNameById(identifier)
                Severity: Minor
                Found in lib/api/redfish-1.0/managers.js - About 1 hr to fix

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

                              return Promise.try(function() {
                                  if(identifier === reservedId){
                                      throw new Errors.NotFoundError();
                                  }
                                  return waterline.nodes.getNodeById(identifier);
                  Severity: Major
                  Found in lib/api/redfish-1.0/managers.js and 1 other location - About 3 hrs to fix
                  lib/api/redfish-1.0/managers.js on lines 489..521

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

                  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 Promise.try(function () {
                                  if(identifier === reservedId){
                                      throw new Errors.NotFoundError();
                                  }
                                  return waterline.nodes.getNodeById(identifier);
                  Severity: Major
                  Found in lib/api/redfish-1.0/managers.js and 1 other location - About 3 hrs to fix
                  lib/api/redfish-1.0/managers.js on lines 440..463

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

                  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 Promise.try(function() {
                                  assert.string(identifier, 'invalid identifier specified: ' + identifier);
                                  return waterline.nodes.needByIdentifier(identifier);
                              })
                              .then(function(node) {
                  Severity: Major
                  Found in lib/api/redfish-1.0/managers.js and 1 other location - About 2 hrs to fix
                  lib/api/redfish-1.0/managers.js on lines 292..308

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

                  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 Promise.try(function() {
                                  assert.string(identifier, 'invalid identifier specified: ' + identifier);
                                  return waterline.nodes.needByIdentifier(identifier);
                              })
                              .then(function(node) {
                  Severity: Major
                  Found in lib/api/redfish-1.0/managers.js and 1 other location - About 2 hrs to fix
                  lib/api/redfish-1.0/managers.js on lines 329..340

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

                  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

                  module.exports = {
                      listManagers: listManagers,
                      getManager: getManager,
                      listManagerNetworkProtocol: listManagerNetworkProtocol,
                      patchManager: patchManager,
                  Severity: Major
                  Found in lib/api/redfish-1.0/managers.js and 1 other location - About 1 hr to fix
                  lib/api/2.0/skus.js on lines 166..177

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

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

                      return Promise.try(function() {
                          if(identifier === reservedId) {
                              return waterline.nodes.find({type: 'compute'});
                          }
                  
                  
                  Severity: Major
                  Found in lib/api/redfish-1.0/managers.js and 4 other locations - About 1 hr to fix
                  lib/api/redfish-1.0/managers.js on lines 70..165
                  lib/api/redfish-1.0/managers.js on lines 193..211
                  lib/api/redfish-1.0/managers.js on lines 172..241
                  lib/api/redfish-1.0/metadata.js on lines 18..29

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

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

                                      return Promise.props({
                                          hostname: os.hostname(),
                                          fqdn: dnsGetFQDN(),
                                          services: services
                                      })
                  Severity: Major
                  Found in lib/api/redfish-1.0/managers.js and 4 other locations - About 1 hr to fix
                  lib/api/redfish-1.0/managers.js on lines 70..165
                  lib/api/redfish-1.0/managers.js on lines 172..241
                  lib/api/redfish-1.0/managers.js on lines 248..280
                  lib/api/redfish-1.0/metadata.js on lines 18..29

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

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

                      return redfish.getVendorNameById(identifier)
                      .catch(function() {return{};})
                      .then(function(result) {
                      if (result.vendor === 'Redfish') {
                              return getRedfishDeviceResponse(identifier, req);
                  Severity: Major
                  Found in lib/api/redfish-1.0/managers.js and 4 other locations - About 1 hr to fix
                  lib/api/redfish-1.0/managers.js on lines 193..211
                  lib/api/redfish-1.0/managers.js on lines 172..241
                  lib/api/redfish-1.0/managers.js on lines 248..280
                  lib/api/redfish-1.0/metadata.js on lines 18..29

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

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

                      return redfish.getVendorNameById(identifier)
                      .catch(function() {return{};})
                      .then(function(result) {
                      if (result.vendor === 'Redfish') {
                              return getRedfishDeviceResponse(identifier, req);
                  Severity: Major
                  Found in lib/api/redfish-1.0/managers.js and 4 other locations - About 1 hr to fix
                  lib/api/redfish-1.0/managers.js on lines 70..165
                  lib/api/redfish-1.0/managers.js on lines 193..211
                  lib/api/redfish-1.0/managers.js on lines 248..280
                  lib/api/redfish-1.0/metadata.js on lines 18..29

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

                  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.getVendorNameById(identifier)
                      .then(function(result) {
                      if (result.vendor === 'Redfish') {
                              return getRedfishDeviceResponse(identifier, req);
                          } else {
                  Severity: Minor
                  Found in lib/api/redfish-1.0/managers.js and 1 other location - About 45 mins to fix
                  lib/api/redfish-1.0/managers.js on lines 287..316

                  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

                      return redfish.getVendorNameById(identifier)
                      .then(function(result) {
                      if (result.vendor === 'Redfish') {
                              return getRedfishDeviceResponse(identifier, req);
                          } else {
                  Severity: Minor
                  Found in lib/api/redfish-1.0/managers.js and 1 other location - About 45 mins to fix
                  lib/api/redfish-1.0/managers.js on lines 324..369

                  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

                  There are no issues that match your filters.

                  Category
                  Status