RackHD/on-http

View on GitHub

Showing 204 of 440 total issues

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

        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

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

                  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

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

                          function factory(Promise, Errors, waterline, uuid, assert,  _, fs) {
                          
                              fs = Promise.promisifyAll(fs);
                          
                              function FileManager(config) {
                          Severity: Minor
                          Found in lib/services/files/file-plugin.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 swaggerValidator has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function swaggerValidator() {
                                  var namespace = '/api/2.0/schemas/';
                                  var schemaPath = path.resolve(__dirname, '../../static/schemas/2.0');
                                  var namespace1Added = schemaApiService.addNamespace(schemaPath, namespace);
                          
                          
                          Severity: Minor
                          Found in lib/services/swagger-api-service.js - About 1 hr to fix

                            Function swagger_authn_authz has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                return function swagger_authn_authz(context, next) {    // jshint ignore:line
                                    if(context.request.user) {
                                        ready.then(function() {
                                            return authz.aclMethod('isAllowed',
                                                context.request.user,
                            Severity: Minor
                            Found in lib/fittings/swagger_authz.js - About 1 hr to fix

                              Function authMiddlewareLogin has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  AuthService.prototype.authMiddlewareLogin = function(req, res, next) {
                                      var self = this;
                              
                                      passport.authenticate('local', {
                                              session: false
                              Severity: Minor
                              Found in lib/services/auth-service.js - About 1 hr to fix

                                Function modifyUser has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                var modifyUser = controller(function(req) {
                                    var name = req.swagger.params.name.value;
                                    var userObj = _.pick(req.swagger.params.body.value, ['password', 'role']);
                                    var configureUsersAllows = ['password', 'role'];
                                    var configureSelfAllows = ['password'];
                                Severity: Minor
                                Found in lib/api/2.0/users.js - About 1 hr to fix

                                  Function putFile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      FileStreamer.prototype.putFile = function(req, filename) {
                                          var self = this;
                                  
                                          return new Promise(function(resolve, reject) {
                                              self.put(req, filename)
                                  Severity: Minor
                                  Found in lib/services/file-service.js - About 1 hr to fix

                                    Function handleErrorMiddleware has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            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';
                                                    logger.error(message, {
                                    Severity: Minor
                                    Found in lib/services/rest-api-service.js - About 1 hr to fix

                                      Function LookupFactory has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      function LookupFactory (Serializable) {
                                          function Lookup (defaults) {
                                              Serializable.call(
                                                  this,
                                                  Lookup.schema,
                                      Severity: Minor
                                      Found in lib/serializables/v1/lookup.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language