RackHD/on-http

View on GitHub

Showing 204 of 440 total issues

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

    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 (typeof options.ipv4 !== "undefined") {
                                      delete 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 (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

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

              waterline,
              Logger,
              _,
              Errors,
              assert,
          Severity: Minor
          Found in lib/services/hooks-api-service.js - About 45 mins to fix

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

            function skuPackServiceFactory(
                _,
                waterline,
                Logger,
                FileLoader,
            Severity: Minor
            Found in lib/services/sku-pack-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

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

            function SshFactory (Promise, Serializable, encryption) {
            
                function Ssh (defaults) {
                    Serializable.call(this, Ssh.schema, defaults);
                }
            Severity: Minor
            Found in lib/serializables/v1/ssh.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

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

                Promise,
                Logger,
                Errors,
                _,
                taskgraphService,
            Severity: Minor
            Found in lib/services/profiles-api-service.js - About 45 mins to fix

              Consider simplifying this complex logical expression.
              Open

                          if (credentials !== undefined
                              && context.request.method === "PUT"
                              && context.request.originalUrl === "/api/2.0/ibms"
                              && context.request.body.config !== undefined
                              && context.request.body.config.user === undefined
              Severity: Major
              Found in lib/fittings/rackhd_validator.js - About 40 mins to fix

                Function staticFilesApiServiceFactory has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    constants,
                    Logger,
                    Promise,
                    configuration,
                    waterline
                Severity: Minor
                Found in lib/services/static-files-api-service.js - About 35 mins to fix

                  Function schemaApiServiceFactory has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      configuration,
                      Logger,
                      Promise,
                      _,
                      nodeFs
                  Severity: Minor
                  Found in lib/services/schema-api-service.js - About 35 mins to fix

                    Function getSoftFwInventory has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function getSoftFwInventory(options, identifier, pathsLookups, keyMatch, matchComponent) {
                    Severity: Minor
                    Found in lib/api/redfish-1.0/update-service.js - About 35 mins to fix

                      Function obmApiServiceFactory has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          waterline,
                          Logger,
                          eventsProtocol,
                          Promise,
                          _
                      Severity: Minor
                      Found in lib/services/obm-api-service.js - About 35 mins to fix

                        Function tagApiServiceFactory has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            waterline,
                            Promise,
                            workflowApiService,
                            Errors,
                            _
                        Severity: Minor
                        Found in lib/services/tags-api-service.js - About 35 mins to fix

                          Function _onMetadata has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              var _onMetadata = function(stream, query, filename, id, metadata) {
                          Severity: Minor
                          Found in lib/services/files/file-plugin.js - About 35 mins to fix

                            Function templateApiServiceFactory has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                Promise,
                                Errors,
                                _,
                                taskgraphService,
                                crypto
                            Severity: Minor
                            Found in lib/services/templates-api-service.js - About 35 mins to fix

                              Function factory has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function factory(assert, _, injector, Errors, Constants) {
                              Severity: Minor
                              Found in lib/services/file-service.js - About 35 mins to fix

                                Function factory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function factory(assert, _, injector, Errors, Constants) {
                                
                                    function FileStreamer() {
                                        this.injectorMap = {
                                            FileSystem: 'Files.FS'
                                Severity: Minor
                                Found in lib/services/file-service.js - About 35 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 too many return statements within this function.
                                Open

                                    return undefined;
                                Severity: Major
                                Found in lib/services/http-service.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          return waterline.nodes.removeListItemsByIdentifier(node.id, targetsToBeRemoved)
                                          .then(function(modifiedNode){
                                              return self.removeRelation(modifiedNode, type);
                                          });
                                  Severity: Major
                                  Found in lib/services/nodes-api-service.js - About 30 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language