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

            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

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

                                        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

                  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 (typeof options.ipv6 === 'undefined' ) {
                                                        options.ipv6 = [];
                                                    }
                    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 (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

                          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 (diskSlotFormat === 2) {
                                                                //Dell 730: Disk.Bay.1-18 = Disk.Bay.18:Enclosure.Internal.0-1:RAID.Integrated.1-1
                                                                catalogedComponentDiskSlot = parseInt(catalogedComponent.fqdd.split(".")[2].split("-")[1]);
                                                            }
                            Severity: Major
                            Found in lib/services/notification-api-service.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                          if (typeof options.ipv4 === 'undefined') {
                                                              options.ipv4 = [];
                                                              var ip4 = {
                                                                  ipaddr: ipaddress
                                                              };
                              Severity: Major
                              Found in lib/api/redfish-1.0/systems.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 (_.includes(fwTypeKeywords, prefix)) {
                                                          FWType = prefix + '-' + element["Firmware Version"];
                                                          entry = {
                                                              "Version": element["Firmware Version"],
                                                              "node": source["node"]
                                  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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language