RackHD/on-http

View on GitHub

Showing 204 of 440 total issues

Function redfishApiServiceFactory has 14 arguments (exceeds 4 allowed). Consider refactoring.
Open

    configuration,
    Logger,
    Promise,
    _,
    nodeFs,
Severity: Major
Found in lib/services/redfish-api-service.js - About 1 hr to fix

    Function getSelLogService has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Function UPnPService has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function UPnPService(options) {
              this.options = options || {};
              this.options.ssdpSig = 'node.js/' + nodeVersion + ' uPnP/1.1 on-http';
              this.options.ssdpTtl = 2;
              this.northbound = _.filter(configuration.get('httpEndpoints', []), 
      Severity: Minor
      Found in lib/services/upnp-service.js - About 1 hr to fix

        Function create has 42 lines of code (exceeds 25 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 1 hr to fix

          Function profileApiServiceFactory has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function profileApiServiceFactory(
              Promise,
              Logger,
              Errors,
              _,
          Severity: Minor
          Found in lib/services/profiles-api-service.js - About 1 hr to fix

            Function createHttpProxy has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function createHttpProxy(app, httpProxy){
                    var sep = path.sep; //The platform-specific file separator. '\\' or '/'
                    try {
                        var localPath = httpProxy.localPath || sep,
                            remotePath = httpProxy.remotePath || sep,
            Severity: Minor
            Found in lib/services/http-service.js - About 1 hr to fix

              Function create has 41 lines of code (exceeds 25 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 1 hr to fix

                Function templateApiServiceFactory has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function templateApiServiceFactory(
                    Promise,
                    Errors,
                    _,
                    taskgraphService,
                Severity: Minor
                Found in lib/services/templates-api-service.js - About 1 hr to fix

                  Function start has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      AccountApiService.prototype.start = function() {
                          var acl = this.acl;
                          var self = this;
                          var endpoints = configuration.get('httpEndpoints', []);
                          var authEnabled = _(endpoints).filter(function(endpoint) {
                  Severity: Minor
                  Found in lib/services/account-api-service.js - About 1 hr to fix

                    Function error_handler has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        return function error_handler(context, next) {    // jshint ignore:line
                            if (!util.isError(context.error)) { return next(); }
                    
                            var err = context.error;
                            var ERROR_STATUS = 400;
                    Severity: Minor
                    Found in lib/fittings/error_handler.js - About 1 hr to fix

                      Function redfishApiServiceFactory has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function redfishApiServiceFactory(
                          configuration,
                          Logger,
                          Promise,
                          _,
                      Severity: Minor
                      Found in lib/services/redfish-api-service.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 setSecureBoot has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      var setSecureBoot = controller(function(req, res)  {
                          //TODO Write logic for non racadm
                          var identifier = req.swagger.params.identifier.value;
                          var options = redfish.makeOptions(req, res, identifier);
                          var graphName = 'Graph.Dell.Wsman.ConfigureBios';
                      Severity: Minor
                      Found in lib/api/redfish-1.0/systems.js - About 1 hr to fix

                        Function unregisterPack has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            SkuPackService.prototype.unregisterPack = function(skuid, conf) {
                                var promises = [];
                                var self = this;
                                var skuRoot = self.confRoot + '/' + skuid;
                                var cleanup;
                        Severity: Minor
                        Found in lib/services/sku-pack-service.js - About 1 hr to fix

                          Function getFile has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              FileStreamer.prototype.getFile = function(req, res, id) {
                                  var self = this;
                                  var uuidFound;
                          
                                  if (id.match(Constants.Regex.uuid)) {
                          Severity: Minor
                          Found in lib/services/file-service.js - About 1 hr to fix

                            Function listSystemBios has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

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

                              Function swagger_validator has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  return function swagger_validator(context, next) {    // jshint ignore:line
                                      if (!context.response.headersSent) {
                                          var schemaNameKey = fittingDef.schemaNameKey;
                                          var operation = context.request.swagger.operation;
                                          var schemaName = operation[schemaNameKey];
                              Severity: Minor
                              Found in lib/fittings/rackhd_validator.js - About 1 hr to fix

                                Function listSystemBiosSettings has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

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

                                  Function listSystemEthernetInterfaces has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

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

                                    Function getClient has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        function getClient() {
                                            return Promise.try(function() {
                                                if (consul) { return consul.agent.service.list(); }
                                    
                                                var taskGraphUrl = url.parse(
                                    Severity: Minor
                                    Found in lib/services/taskgraph-api-service.js - About 1 hr to fix

                                      Function SnmpFactory has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      function SnmpFactory (Promise, Serializable, encryption) {
                                      
                                          function Snmp (defaults) {
                                              Serializable.call(this, Snmp.schema, defaults);
                                          }
                                      Severity: Minor
                                      Found in lib/serializables/v1/snmp.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language