RackHD/on-http

View on GitHub

Showing 204 of 440 total issues

Function modifyUserByName has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    AccountApiService.prototype.modifyUserByName = function(name, info) {
        var self = this;
        return Promise.try(function() {
            assert.string(name);
            return waterline.localusers.findOne({username: name});
Severity: Minor
Found in lib/services/account-api-service.js - About 1 hr to fix

    Function runRpc has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function runRpc(funcName) {
            var _arguments = Array.prototype.slice.call(arguments);
            var args = _arguments.slice(1);
            return getClient()
            .then(function(client) {
    Severity: Minor
    Found in lib/services/taskgraph-api-service.js - About 1 hr to fix

      Function runClientObserver has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          UPnPService.prototype.runClientObserver = function(address) {
              var self = this;
              self.client = new Client({unicastHost:address});
              self.client.on('response', function inResponse(headers, code, info) {
                  var ttl = parseInt(headers['CACHE-CONTROL'].split('=')[1].trim());
      Severity: Minor
      Found in lib/services/upnp-service.js - About 1 hr to fix

        Function accountApiServiceFactory has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            waterline,
            Errors,
            Logger,
            _,
            Promise,
        Severity: Major
        Found in lib/services/account-api-service.js - About 1 hr to fix

          Function firmwareCatalogsIdGet has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          var firmwareCatalogsIdGet = controller(function(req) {
              return catalogs.getFirmwareCatalogById(req.swagger.params.identifier.value)
              .then(function (result){
                  var data = {};
                  if (result){
          Severity: Minor
          Found in lib/api/2.0/catalogs.js - About 55 mins 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 factory has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function factory(Promise, Errors, waterline, uuid, assert,  _, fs) {
          Severity: Major
          Found in lib/services/files/file-plugin.js - About 50 mins to fix

            Function NodeFactory has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                Promise,
                Serializable,
                ObmSerializable,
                SnmpSerializable,
                SshSerializable,
            Severity: Major
            Found in lib/serializables/v1/node.js - About 50 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                              if (typeof options.ipv6 === 'undefined' ) {
                                                  options.ipv6 = [];
                                              }
              Severity: Major
              Found in lib/api/redfish-1.0/systems.js - About 45 mins to fix

                Function getSessions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                var getSessions = controller(function(req, res) {
                    var options = redfish.makeOptions(req, res);
                    options.sessions = _.filter(auth.getRedfishSession(), function(session) {
                        if( req.isAuthenticated && req.isAuthenticated() ) {
                            if( req.hasRole('Administrator') || req.hasRole('ConfigureUsers') ||
                Severity: Minor
                Found in lib/api/redfish-1.0/session-service.js - About 45 mins 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

                Avoid deeply nested control flow statements.
                Open

                                        } else if (!foundComponent) {
                                            logger.debug("Couldn't compute the match of " + amqpMessage.data.OriginOfCondition);
                                            return amqpMessage;
                                        }
                Severity: Major
                Found in lib/services/notification-api-service.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (id === driveIndex && typeof drive.SMART.Identity["Rotation Rate"] !== 'undefined') {
                                              return drive;
                                          }
                  Severity: Major
                  Found in lib/api/redfish-1.0/systems.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if (typeof options.ipv6 !== "undefined") {
                                                    delete options.ipv6;
                                                }
                    Severity: Major
                    Found in lib/api/redfish-1.0/systems.js - About 45 mins to fix

                      Function pollerApiServiceFactory has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          waterline,
                          taskProtocol,
                          Errors,
                          _,
                          Promise,
                      Severity: Minor
                      Found in lib/services/pollers-api-service.js - About 45 mins to fix

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

                        module.exports = function create(fittingDef, bagpipes) {
                            injector = require('../../index.js').injector;
                            var authz = injector.get('Http.Services.Api.Account');
                            var swaggerNodeRunner = bagpipes.config.swaggerNodeRunner;
                            var ready = loadSwagger(authz, swaggerNodeRunner.swagger);
                        Severity: Minor
                        Found in lib/fittings/swagger_authz.js - About 45 mins 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

                        Avoid deeply nested control flow statements.
                        Open

                                                        if (typeof options.ipv4 === 'undefined' ) {
                                                            options.ipv4 = [];
                                                        }
                        Severity: Major
                        Found in lib/api/redfish-1.0/systems.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                          if (
                                                              parseInt(alertDiskSlot) === parseInt(catalogedComponentDiskSlot)
                                                              && !foundComponent) {
                                                              foundComponent = true;
                                                              amqpMessage = updateSnPn(amqpMessage, catalogedComponent);
                          Severity: Major
                          Found in lib/services/notification-api-service.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                        if(!(id in controllers)) {
                                                            controllers[id] = [];
                                                        }
                            Severity: Major
                            Found in lib/api/redfish-1.0/systems.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                          if (fwTypes[FWType] === undefined) {
                                                              fwTypes[FWType] = [entry];
                                                          } else {
                                                              fwTypes[FWType].push(entry);
                                                          }
                              Severity: Major
                              Found in lib/api/redfish-1.0/update-service.js - About 45 mins to fix

                                Function wsmanServiceFactory has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    waterline,
                                    encryption,
                                    configuration,
                                    WsmanTool,
                                    errors,
                                Severity: Minor
                                Found in lib/services/wsman-service.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if (fwTypes[FWType] === undefined) {
                                                              fwTypes[FWType] = [entry];
                                                          } else {
                                                              fwTypes[FWType].push(entry);
                                                          }
                                  Severity: Major
                                  Found in lib/api/redfish-1.0/update-service.js - About 45 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language