RackHD/on-http

View on GitHub

Showing 440 of 440 total issues

Function validate has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    SchemaApiService.prototype.validate = function(obj, schemaName)  {
        return Promise.resolve().then(function() {
            var basename;

            // If a schemaName is specified, then validate against that
Severity: Minor
Found in lib/services/schema-api-service.js - About 1 hr to fix

    Function NodeFactory has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    function NodeFactory (
        Promise,
        Serializable,
        ObmSerializable,
        SnmpSerializable,
    Severity: Minor
    Found in lib/serializables/v1/node.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 taskgraphApiServiceFactory has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    function taskgraphApiServiceFactory(
        Errors,
        configuration,
        Promise,
        _
    Severity: Minor
    Found in lib/services/taskgraph-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 start has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function start() {
            return core.start()
                .then(function() {
                    return Promise.all([views.load()]);
                })
    Severity: Minor
    Found in app.js - About 1 hr to fix

      Function getLcLogServiceEntry has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

                if(result.vendor === 'Dell'){
                    return dataFactory(identifier, 'hardware')
                    .then(function(hardware) {
                        options.hardware = hardware;
                    })
        Severity: Major
        Found in lib/api/redfish-1.0/systems.js and 1 other location - About 1 hr to fix
        lib/api/redfish-1.0/systems.js on lines 695..724

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

        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

                } else if(result.vendor === 'Cisco'){
                    return dataFactory(identifier, 'UCS')
                    .then(function(data) {
                        options.processors = data;
                    })
        Severity: Major
        Found in lib/api/redfish-1.0/systems.js and 1 other location - About 1 hr to fix
        lib/api/redfish-1.0/systems.js on lines 683..724

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

        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 swaggerSerdes has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            return function swaggerSerdes(context, next) {
                var serdesNameKey = fittingDef.serdesNameKey;
                var operation = context.request.swagger.operation;
                var serdesName;
                var serdes;
        Severity: Minor
        Found in lib/fittings/swagger_serdes.js - About 1 hr to fix

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

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

            module.exports = {
                listManagers: listManagers,
                getManager: getManager,
                listManagerNetworkProtocol: listManagerNetworkProtocol,
                patchManager: patchManager,
            Severity: Major
            Found in lib/api/redfish-1.0/managers.js and 1 other location - About 1 hr to fix
            lib/api/2.0/skus.js on lines 166..177

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

            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

            module.exports = {
                skusGet: skusGet,
                skusIdGet: skusIdGet,
                skusPost: skusPost,
                skusPut: skusPut,
            Severity: Major
            Found in lib/api/2.0/skus.js and 1 other location - About 1 hr to fix
            lib/api/redfish-1.0/managers.js on lines 529..540

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

            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 generatePdf has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function generatePdf(swaggerFile) {
                fs.readFile(swaggerFile, {encoding: 'utf8'}, function (err, swaggerData) {
                    if (err) {
                        return console.log(err);
                    }
            Severity: Minor
            Found in extra/swagger-doc.js - About 1 hr to fix

              Function getLocalEthernetInterface has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var getLocalEthernetInterface = controller(function(req, res) {
                  var options = redfish.makeOptions(req, res);
                  var index = req.swagger.params.index.value;
                  return Promise.try(function() {
                  var net = _.get(os.networkInterfaces(), index);
              Severity: Minor
              Found in lib/api/redfish-1.0/managers.js - About 1 hr to fix

                Function hookApiServiceFactory has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

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

                          {
                              service: 'ipmi-obm-service',
                              config: {
                                  host: {
                                      default: 'localhost',
                  Severity: Major
                  Found in lib/services/obm-api-service.js and 1 other location - About 1 hr to fix
                  lib/services/obm-api-service.js on lines 218..234

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

                  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

                          {
                              service: 'dell-wsman-obm-service',
                              config: {
                                  host: {
                                      default: 'localhost',
                  Severity: Major
                  Found in lib/services/obm-api-service.js and 1 other location - About 1 hr to fix
                  lib/services/obm-api-service.js on lines 62..78

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

                  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 3 locations. Consider refactoring.
                  Open

                  var profilesGetMetadataByName = controller(function (req) {
                      return profilesApiService.profilesMetaGetByName(req.swagger.params.name.raw, req.swagger.query.scope);
                  });
                  Severity: Major
                  Found in lib/api/2.0/profiles.js and 2 other locations - About 1 hr to fix
                  lib/api/2.0/templates.js on lines 18..21
                  lib/api/2.0/templates.js on lines 25..27

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

                  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

                          return Promise.try(function() {
                              if (!message.nodeId || !_.isString(message.nodeId)) {
                                  throw new Errors.BadRequestError('Invalid node ID in query or body');
                              }
                          })
                  Severity: Major
                  Found in lib/services/notification-api-service.js and 1 other location - About 1 hr to fix
                  lib/services/workflow-api-service.js on lines 41..52

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

                  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 3 locations. Consider refactoring.
                  Open

                  var templatesLibGet = controller(function(req) {
                      return templateApiService.templatesLibGet(req.swagger.params.name.raw, req.swagger.query.scope);
                  });
                  Severity: Major
                  Found in lib/api/2.0/templates.js and 2 other locations - About 1 hr to fix
                  lib/api/2.0/profiles.js on lines 18..20
                  lib/api/2.0/templates.js on lines 18..21

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

                  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

                          {
                              service: 'servertech-obm-service',
                              config: {
                                  host: {
                                      default: 'localhost',
                  Severity: Major
                  Found in lib/services/obm-api-service.js and 1 other location - About 1 hr to fix
                  lib/services/obm-api-service.js on lines 45..61

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

                  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