RackHD/on-http

View on GitHub

Showing 440 of 440 total issues

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

              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

                                        } 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

                  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

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

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                          return redfish.getVendorNameById(identifier)
                          .then(function(result) {
                          if (result.vendor === 'Redfish') {
                                  return getRedfishDeviceResponse(identifier, req);
                              } else {
                      Severity: Minor
                      Found in lib/api/redfish-1.0/managers.js and 1 other location - About 45 mins to fix
                      lib/api/redfish-1.0/managers.js on lines 324..369

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 50.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                          return redfish.getVendorNameById(identifier)
                          .then(function(result) {
                          if (result.vendor === 'Redfish') {
                                  return getRedfishDeviceResponse(identifier, req);
                              } else {
                      Severity: Minor
                      Found in lib/api/redfish-1.0/managers.js and 1 other location - About 45 mins to fix
                      lib/api/redfish-1.0/managers.js on lines 287..316

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 50.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                      var filesDelete = controller({send204OnEmpty: true}, function(req) {
                          return fileService.deleteFile(req.swagger.params.fileidentifier.value);
                      });
                      Severity: Minor
                      Found in lib/api/2.0/files.js and 1 other location - About 45 mins to fix
                      lib/api/2.0/pollers.js on lines 180..182

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 50.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                                      if( req.hasRole('Administrator') || req.hasRole('ConfigureUsers') ||
                                          (req.user === found.user && req.hasRole('ConfigureSelf'))) {
                                          options.entry = found;
                                          return redfish.render('redfish.1.0.0.session.1.0.0.json',
                                              'Session.v1_0_3.json#/definitions/Session',
                      Severity: Minor
                      Found in lib/api/redfish-1.0/session-service.js and 1 other location - About 45 mins to fix
                      lib/api/redfish-1.0/session-service.js on lines 28..31

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 50.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      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

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        var pollersDataGet = controller( {send204OnEmpty:true}, function (req){
                            return pollers.getPollersByIdData(req.swagger.params.identifier.value);
                        });
                        Severity: Minor
                        Found in lib/api/2.0/pollers.js and 1 other location - About 45 mins to fix
                        lib/api/2.0/files.js on lines 31..33

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 50.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        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

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                    if( req.hasRole('Administrator') || req.hasRole('ConfigureUsers') ||
                                        (req.user === session.user && req.hasRole('ConfigureSelf'))) {
                                        return true;
                                    }
                        Severity: Minor
                        Found in lib/api/redfish-1.0/session-service.js and 1 other location - About 45 mins to fix
                        lib/api/redfish-1.0/session-service.js on lines 67..73

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 50.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Severity
                        Category
                        Status
                        Source
                        Language