RackHD/on-http

View on GitHub

Showing 204 of 440 total issues

Function workflowApiServiceFactory has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function workflowApiServiceFactory(
    eventsProtocol,
    Logger,
    Errors,
    Promise,
Severity: Major
Found in lib/services/workflow-api-service.js - About 3 hrs to fix

    Function getFwCollections has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getFwCollections(fwTypeKeywords, catalogs) {
        //Return a collection of the unique FW versions and its related components
        var fwTypes = {};
        _.forEach(catalogs, function (catalog) {
            _.forEach(catalog, function (sources) {
    Severity: Major
    Found in lib/api/redfish-1.0/update-service.js - About 3 hrs to fix

      Function authServiceFactory has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      function authServiceFactory(
          assert,
          configuration,
          _,
          waterline
      Severity: Minor
      Found in lib/services/auth-service.js - About 3 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 getSimpleStorage has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function getThermal has 82 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var getThermal = controller(function(req, res) {
            var chassisId = req.swagger.params.identifier.value.split('.')[0];
            var systemId = req.swagger.params.identifier.value.split('.')[1];
        
            return redfish.getVendorNameById(chassisId)
        Severity: Major
        Found in lib/api/redfish-1.0/chassis.js - About 3 hrs to fix

          Function registerPack has 82 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              SkuPackService.prototype.registerPack = function(skuId, contents) {
                  var promises = [];
                  var self = this;
                  var skuRoot = self.confRoot + '/' + skuId;
          
          
          Severity: Major
          Found in lib/services/sku-pack-service.js - About 3 hrs to fix

            Function create has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function create(fittingDef) {
                var validate = validator();
                return function swagger_validator(context, next) {    // jshint ignore:line
                    if (!context.response.headersSent) {
                        var schemaNameKey = fittingDef.schemaNameKey;
            Severity: Minor
            Found in lib/fittings/rackhd_validator.js - About 3 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 getStorage has 80 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Function getPower has 78 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var getPower = controller(function(req, res) {
                  var chassisId = req.swagger.params.identifier.value.split('.')[0];
                  var systemId = req.swagger.params.identifier.value.split('.')[1];
              
                  return redfish.getVendorNameById(chassisId)
              Severity: Major
              Found in lib/api/redfish-1.0/chassis.js - About 3 hrs to fix

                Function UPnPServiceFactory has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                function UPnPServiceFactory(
                    _,
                    waterline,
                    Logger,
                    Profiles,
                Severity: Minor
                Found in lib/services/upnp-service.js - About 3 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 notification-api-service.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                // Copyright © 2016-2017 Dell Inc. or its subsidiaries.  All Rights Reserved.
                
                'use strict';
                
                var di = require('di');
                Severity: Minor
                Found in lib/services/notification-api-service.js - About 3 hrs to fix

                  File event-service.js has 291 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  // Copyright 2016, EMC, Inc.
                  
                  'use strict';
                  var urlParse = require('url-parse');
                  var injector = require('../../../index.js').injector;
                  Severity: Minor
                  Found in lib/api/redfish-1.0/event-service.js - About 3 hrs to fix

                    Function create has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports = function create(fittingDef, bagpipes) {
                        var swaggerNodeRunner = bagpipes.config.swaggerNodeRunner;
                        var appRoot = swaggerNodeRunner.config.swagger.appRoot;
                        var serdesDirs = fittingDef.serdesDirs.map(function(dir) {
                            return path.resolve(appRoot, dir);
                    Severity: Minor
                    Found in lib/fittings/swagger_serdes.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 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 SshFactory has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function SshFactory (Promise, Serializable, encryption) {
                      
                          function Ssh (defaults) {
                              Serializable.call(this, Ssh.schema, defaults);
                          }
                      Severity: Major
                      Found in lib/serializables/v1/ssh.js - About 2 hrs to fix

                        Function doReset has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

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

                          Function schemaApiServiceFactory has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function schemaApiServiceFactory(
                              configuration,
                              Logger,
                              Promise,
                              _,
                          Severity: Minor
                          Found in lib/services/schema-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

                          File account-api-service.js has 279 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/account-api-service.js - About 2 hrs to fix

                            Function httpEventMiddleware has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                function httpEventMiddleware(req, res, next) {
                                    req._startAt = process.hrtime();
                                    res.locals.ipAddress = remoteAddress(req);
                                    res.locals.scope = ['global'];
                                    res.locals.uuid = uuid.v4();
                            Severity: Major
                            Found in lib/services/http-service.js - About 2 hrs to fix

                              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
                                Severity
                                Category
                                Status
                                Source
                                Language