RackHD/on-http

View on GitHub

Showing 440 of 440 total issues

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

        {
            service: 'apc-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 105..121

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 templatesMetaGetByName = controller(function(req) {
    return templateApiService.templatesMetaGetByName(req.swagger.params.name.value,
        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 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 (!configuration.name || !_.isString(configuration.name)) {
                throw new Errors.BadRequestError('Graph name is missing or in wrong format');
            }
        })
Severity: Major
Found in lib/services/workflow-api-service.js and 1 other location - About 1 hr to fix
lib/services/notification-api-service.js on lines 86..93

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

Function onHttpContextFactory has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function onHttpContextFactory(di, directory) {
    di = di || _di;

    var core = onCore(di, directory),
        helper = core.helper;
Severity: Minor
Found in index.js - About 1 hr to fix

    Function listManagerEthernetInterfaces has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Function taskApiServiceFactory has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          taskProtocol,
          waterline,
          Errors,
          util,
          configuration,
      Severity: Major
      Found in lib/services/task-api-service.js - About 1 hr to fix

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

        var nodesGetCatalogSourceById = controller(function(req) {
            return nodes.getNodeCatalogSourceById(req.swagger.params.identifier.value,
                                                  req.swagger.params.source.value);
        });
        Severity: Major
        Found in lib/api/2.0/nodes.js and 2 other locations - About 1 hr to fix
        lib/api/2.0/obms.js on lines 48..52
        lib/api/2.0/skus.js on lines 107..109

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

        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 obmsPatchById = controller( function(req) {
            return obmsService.updateObmById(
                req.swagger.params.identifier.value, req.swagger.params.body.value);
        
        });
        Severity: Major
        Found in lib/api/2.0/obms.js and 2 other locations - About 1 hr to fix
        lib/api/2.0/nodes.js on lines 53..56
        lib/api/2.0/skus.js on lines 107..109

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

        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 skusPatch = controller( function (req) {
            return   skuPack.patchSku(req.swagger.params.identifier.value, req.swagger.params.body.value);
        });
        Severity: Major
        Found in lib/api/2.0/skus.js and 2 other locations - About 1 hr to fix
        lib/api/2.0/nodes.js on lines 53..56
        lib/api/2.0/obms.js on lines 48..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 60.

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

        var createSubscription = controller(function(req, res) {
            var options = redfish.makeOptions(req, res);
            var event = req.swagger.params.payload.value;
            return redfish.validateSchema(event,
                'EventDestination.v1_1_1.json#/definitions/EventDestination'
        Severity: Minor
        Found in lib/api/redfish-1.0/event-service.js - About 1 hr to fix

          Function ibmsPatchById has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var ibmsPatchById = controller( function(req) {
              var ibmId = req.swagger.params.identifier.value;
              var values = req.swagger.params.body.value;
              return waterline.ibms.needByIdentifier(ibmId)
                  .then(function(oldIbm) {
          Severity: Minor
          Found in lib/api/2.0/ibms.js - About 1 hr to fix

            Function skuChassisParamHandler has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var skuChassisParamHandler = function(context, value) {
                var injector = require('../../index.js').injector;
                var nodeServiceApi = injector.get('Http.Services.Api.Nodes');
                return nodeServiceApi.getAllNodes({
                    or: [
            Severity: Minor
            Found in lib/fittings/swagger_locals.js - About 1 hr to fix

              Function _onMetadata has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var _onMetadata = function(stream, query, filename, id, metadata) {
                      var self = this;
              
                      return self.createOrUpdateEntry({
                          basename: query,
              Severity: Minor
              Found in lib/services/files/file-plugin.js - About 1 hr to fix

                Function editNodeRelations has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    NodeApiService.prototype.editNodeRelations = function(id, body, handler) {
                        var self = this;
                        return waterline.nodes.needByIdentifier(id).bind({})
                        .then(function(node) {
                            this.parentNode = node;
                Severity: Minor
                Found in lib/services/nodes-api-service.js - About 1 hr to fix

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

                              if( Object.keys(_.omit(req.swagger.params.body.value, configureUsersAllows)).length !== 0 ) {
                                  throw new Errors.BadRequestError('Bad Request');
                              }
                  Severity: Major
                  Found in lib/api/2.0/users.js and 1 other location - About 1 hr to fix
                  lib/api/2.0/users.js on lines 70..72

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

                  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 Promise.props({
                                  id: user.id,
                                  username: user.username,
                                  role: user.role,
                                  privileges: self.aclMethod('_rolesParents', [user.role])
                  Severity: Major
                  Found in lib/services/account-api-service.js and 1 other location - About 1 hr to fix
                  lib/services/account-api-service.js on lines 94..99

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

                  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 Promise.props({
                                  id: user.id,
                                  username: user.username,
                                  role: user.role,
                                  privileges: self.aclMethod('_rolesParents', [user.role])
                  Severity: Major
                  Found in lib/services/account-api-service.js and 1 other location - About 1 hr to fix
                  lib/services/account-api-service.js on lines 113..118

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

                  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( Object.keys(_.omit(req.swagger.params.body.value, configureSelfAllows)).length !== 0 ) {
                                  throw new Errors.BadRequestError('Bad Request');
                              }
                  Severity: Major
                  Found in lib/api/2.0/users.js and 1 other location - About 1 hr to fix
                  lib/api/2.0/users.js on lines 65..67

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

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

                      NotificationApiService.prototype.publishTaskProgress = function(message) {
                          var progressData;
                          return Promise.try(function() {
                              message.value = parseInt(message.value);
                              message.maximum = parseInt(message.maximum);
                  Severity: Minor
                  Found in lib/services/notification-api-service.js - About 1 hr to fix

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

                        ObmApiService.prototype.updateObmById = function(obmId, values) {
                            return waterline.obms.needByIdentifier(obmId)
                            .then(function(oldObm) {
                                /* Get nodes that need to publish events */
                                if (oldObm.node && !values.nodeId) {
                    Severity: Minor
                    Found in lib/services/obm-api-service.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language