RackHD/on-http

View on GitHub

Showing 204 of 440 total issues

Function wsmanServiceFactory has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function wsmanServiceFactory(
    waterline,
    encryption,
    configuration,
    WsmanTool,
Severity: Major
Found in lib/services/wsman-service.js - About 2 hrs to fix

    File obm-api-service.js has 276 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Copyright 2016, EMC, Inc.
    
    'use strict';
    
    var di = require('di');
    Severity: Minor
    Found in lib/services/obm-api-service.js - About 2 hrs to fix

      Function installPack has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          SkuPackService.prototype.installPack = function(fromRoot, skuid) {
              var self = this;
              var contents;
              return fs.readFileAsync(fromRoot + '/config.json')
              .then(function(fileContents) {
      Severity: Major
      Found in lib/services/sku-pack-service.js - About 2 hrs to fix

        Function postNode has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            NodeApiService.prototype.postNode = function(body) {
                var nodeBody = _.omit(body, ['obms', 'ibms']);
                var obmBody = body.obms || body.obmSettings || null;
                var ibmBody = body.ibms || null;
        
        
        Severity: Major
        Found in lib/services/nodes-api-service.js - About 2 hrs to fix

          Function getDrive has 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var getDrive = controller(function(req, res)  {
              var identifier = req.swagger.params.identifier.value;
              var index = req.swagger.params.index.value;
              var driveIndex = req.swagger.params.driveIndex.value;
          
          
          Severity: Major
          Found in lib/api/redfish-1.0/systems.js - About 2 hrs to fix

            Function addHotspare has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var addHotspare = controller(function(req,res) {
                var identifier = req.swagger.params.identifier.value;
                var driveIndex = req.swagger.params.driveIndex.value;
                var payload = req.swagger.params.payload.value;
                /*
            Severity: Major
            Found in lib/api/redfish-1.0/systems.js - About 2 hrs to fix

              Function getSerialNumber has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function getSerialNumber(amqpMessage) {
                      //amqpMessage.data.originOfCondition = "Disk.Bay.1-0";
                      if (amqpMessage.data.OriginOfCondition !== null && amqpMessage.data.OriginOfCondition  !== undefined) {
                      var diskType;
                      var splitAlertName = amqpMessage.data.OriginOfCondition.split(".");
              Severity: Major
              Found in lib/services/notification-api-service.js - About 2 hrs to fix

                Function listStorage has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var listStorage = controller(function (req, res) {
                    var identifier = req.swagger.params.identifier.value;
                    return redfish.getVendorNameById(identifier)
                    .then(function (result) {
                        identifier = result.node.id;
                Severity: Major
                Found in lib/api/redfish-1.0/systems.js - About 2 hrs to fix

                  Function addRelation has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      NodeApiService.prototype.addRelation = function addRelation(node, type, targets) {
                          if (!(node && type && targets)) {
                              return;
                          }
                          return waterline.nodes.addFieldIfNotExistByIdentifier(node.id, "relations", [])
                  Severity: Major
                  Found in lib/services/nodes-api-service.js - About 2 hrs to fix

                    Function _render has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function _render(viewName, req, res) {
                            var options;
                    
                            return Promise.try(function() {
                                assert.optionalString(viewName);
                    Severity: Major
                    Found in lib/services/swagger-api-service.js - About 2 hrs to fix

                      Function getNetwork has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Function skuPackHandler has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            SkuPackService.prototype.skuPackHandler = function(req,res,skuid) {
                                var self = this;
                                var name = uuid('v4');
                                var tmpDir = tmp();
                        
                        
                        Severity: Major
                        Found in lib/services/sku-pack-service.js - About 2 hrs to fix

                          Function getSystem has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          var getSystem = controller(function(req, res) {
                              var identifier = req.swagger.params.identifier.value;
                              return redfish.getVendorNameById(identifier)
                              .then(function(result){
                                  var node = result.node;
                          Severity: Major
                          Found in lib/api/redfish-1.0/systems.js - About 2 hrs to fix

                            Function obmApiServiceFactory has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function obmApiServiceFactory(
                                waterline,
                                Logger,
                                eventsProtocol,
                                Promise,
                            Severity: Minor
                            Found in lib/services/obm-api-service.js - About 2 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 deleteVolume has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            var deleteVolume = controller(function(req,res) {
                                var identifier = req.swagger.params.identifier.value;
                                var volumeIndex = req.swagger.params.volumeIndex.value;
                                var payload = req.swagger.params.payload.value;
                                var graphName = 'Graph.Dell.Wsman.Delete.Volume';
                            Severity: Major
                            Found in lib/api/redfish-1.0/systems.js - About 2 hrs to fix

                              Function _setup has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  HttpService.prototype._setup =  function() {
                                      var app = this.app;
                                      var endpoint = this.endpoint;
                              
                                      // CORS Support
                              Severity: Major
                              Found in lib/services/http-service.js - About 2 hrs to fix

                                Function getSystemProcessor has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

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

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

                                      NodeApiService.prototype.removeNode = function(node, srcType) {
                                          var self = this;
                                          return self._delValidityCheck(node.id)
                                          .then(function () {
                                              if (!node.hasOwnProperty('relations')) {
                                  Severity: Major
                                  Found in lib/services/nodes-api-service.js - About 2 hrs to fix

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

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

                                      Function dataFactory has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      var dataFactory = function(identifier, dataName) {
                                          switch(dataName)  {
                                              case 'catData':
                                                  return Promise.all([nodeApi.getNodeCatalogSourceById(identifier,'ohai'), nodeApi.getNodeCatalogSourceById(identifier,'dmi')])
                                                      .spread(function(ohai, dmi) {
                                      Severity: Major
                                      Found in lib/api/redfish-1.0/systems.js - About 2 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language