RackHD/on-http

View on GitHub

Showing 440 of 440 total issues

Function getLcLogService has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var getLcLogService = controller(function(req, res)  {
    var identifier = req.swagger.params.identifier.value;

    return redfish.getVendorNameById(identifier)
    .then(function(result){
Severity: Minor
Found in lib/api/redfish-1.0/systems.js - About 1 hr to fix

    Function listVolume has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Function handleError has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          rest.handleError = function () {
              return function handleErrorMiddleware(err, req, res, next) {
                  // TODO - implement custom error type serializers
                  if (err instanceof Error || err instanceof ErrorEvent) {
                      var message = err.message || http.STATUS_CODES[err.status] || 'Unspecified Error';
      Severity: Minor
      Found in lib/services/rest-api-service.js - About 1 hr to fix

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

            return redfish.getVendorNameById(identifier)
            .catch(function() {return{};})
            .then(function(result) {
            if (result.vendor === 'Redfish') {
                    return getRedfishDeviceResponse(identifier, req);
        Severity: Major
        Found in lib/api/redfish-1.0/managers.js and 4 other locations - About 1 hr to fix
        lib/api/redfish-1.0/managers.js on lines 193..211
        lib/api/redfish-1.0/managers.js on lines 172..241
        lib/api/redfish-1.0/managers.js on lines 248..280
        lib/api/redfish-1.0/metadata.js on lines 18..29

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

        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

            Boot.schema = {
                id: 'Serializables.V1.Boot',
                type: 'object',
                properties: {
                    profile: {
        Severity: Major
        Found in lib/serializables/v1/boot.js and 1 other location - About 1 hr to fix
        lib/serializables/v1/obm.js on lines 33..45

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

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

            return Promise.try(function() {
                return fs.readFileAsync(fromRoot + '/static/redfishMetadata.xml', 'utf8');
            })
            .then(function(fileContent) {
                return fileContent;
        Severity: Major
        Found in lib/api/redfish-1.0/metadata.js and 4 other locations - About 1 hr to fix
        lib/api/redfish-1.0/managers.js on lines 70..165
        lib/api/redfish-1.0/managers.js on lines 193..211
        lib/api/redfish-1.0/managers.js on lines 172..241
        lib/api/redfish-1.0/managers.js on lines 248..280

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

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

            return Promise.try(function() {
                if(identifier === reservedId) {
                    return waterline.nodes.find({type: 'compute'});
                }
        
        
        Severity: Major
        Found in lib/api/redfish-1.0/managers.js and 4 other locations - About 1 hr to fix
        lib/api/redfish-1.0/managers.js on lines 70..165
        lib/api/redfish-1.0/managers.js on lines 193..211
        lib/api/redfish-1.0/managers.js on lines 172..241
        lib/api/redfish-1.0/metadata.js on lines 18..29

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

        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(result.vendor === 'Dell'){
                    return wsman.getLog(node, options.type)
                    .then(function(selData) {
                        options.logEntries = selData;
                        return redfish.render('wsman.1.0.0.logentrycollection.json',
        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 1537..1549

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

        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 removeRole = controller({ success: 204 }, function (req) {
            var name = req.swagger.params.name.value;
            return accountService.removeRoleByName(name);
        });
        Severity: Major
        Found in lib/api/2.0/roles2.0.js and 1 other location - About 1 hr to fix
        lib/api/2.0/users.js on lines 88..91

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

        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

            Obm.schema = {
                id: 'Serializables.V1.Obm',
                type: 'object',
                properties: {
                    service: {
        Severity: Major
        Found in lib/serializables/v1/obm.js and 1 other location - About 1 hr to fix
        lib/serializables/v1/boot.js on lines 29..41

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

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

            return redfish.getVendorNameById(identifier)
            .catch(function() {return{};})
            .then(function(result) {
            if (result.vendor === 'Redfish') {
                    return getRedfishDeviceResponse(identifier, req);
        Severity: Major
        Found in lib/api/redfish-1.0/managers.js and 4 other locations - About 1 hr to fix
        lib/api/redfish-1.0/managers.js on lines 70..165
        lib/api/redfish-1.0/managers.js on lines 193..211
        lib/api/redfish-1.0/managers.js on lines 248..280
        lib/api/redfish-1.0/metadata.js on lines 18..29

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

        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(result.vendor === 'Dell'){
                    return wsman.getLog(node, options.type)
                    .then(function(lcData) {
                        options.logEntries = lcData;
                        return redfish.render('wsman.1.0.0.lclogentrycollection.json',
        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 1394..1418

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

        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 removeUser = controller({success: 204}, function(req) {
            var name = req.swagger.params.name.value;
            return accountService.removeUserByName(name);
        });
        Severity: Major
        Found in lib/api/2.0/users.js and 1 other location - About 1 hr to fix
        lib/api/2.0/roles2.0.js on lines 30..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 58.

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

                            return Promise.props({
                                hostname: os.hostname(),
                                fqdn: dnsGetFQDN(),
                                services: services
                            })
        Severity: Major
        Found in lib/api/redfish-1.0/managers.js and 4 other locations - About 1 hr to fix
        lib/api/redfish-1.0/managers.js on lines 70..165
        lib/api/redfish-1.0/managers.js on lines 172..241
        lib/api/redfish-1.0/managers.js on lines 248..280
        lib/api/redfish-1.0/metadata.js on lines 18..29

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

        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 workflowApiServiceFactory has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            eventsProtocol,
            Logger,
            Errors,
            Promise,
            Constants,
        Severity: Major
        Found in lib/services/workflow-api-service.js - About 1 hr to fix

          Function NotificationApiServiceFactory has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

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

            Function restFactory has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                Serializable,
                Promise,
                _,
                assert,
                util,
            Severity: Major
            Found in lib/services/rest-api-service.js - About 1 hr to fix

              Function rest has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function rest(callback, options) {
                      assert.func(callback, 'callback function is required');
                      assert.optionalObject(options, 'options should be an optional object');
              
                      options = options || {};
              Severity: Minor
              Found in lib/services/rest-api-service.js - About 1 hr to fix

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

                var listDCIMCoolingDefault = controller(function (req, res) {
                    var identifier = req.swagger.params.identifier.value;
                    return nodeApi.getNodeCatalogSourceById(identifier, req.url);
                });
                Severity: Major
                Found in lib/api/redfish-1.0/dcimcooling.js and 1 other location - About 1 hr to fix
                lib/api/redfish-1.0/dcimpower.js on lines 77..80

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

                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 = {
                    pollersLibGet: pollersLibGet,
                    pollersLibByIdGet: pollersLibByIdGet,
                    pollersGet: pollersGet,
                    pollersIdGet: pollersIdGet,
                Severity: Major
                Found in lib/api/2.0/pollers.js and 1 other location - About 1 hr to fix
                lib/api/redfish-1.0/event-service.js on lines 294..304

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

                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