RackHD/on-http

View on GitHub

Showing 204 of 440 total issues

Function factory has 175 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function factory(assert, _, injector, Errors, Constants) {

    function FileStreamer() {
        this.injectorMap = {
            FileSystem: 'Files.FS'
Severity: Major
Found in lib/services/file-service.js - About 7 hrs to fix

    Function factory has 169 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function factory(Promise, Errors, waterline, uuid, assert,  _, fs) {
    
        fs = Promise.promisifyAll(fs);
    
        function FileManager(config) {
    Severity: Major
    Found in lib/services/files/file-plugin.js - About 6 hrs to fix

      Function httpServiceFactory has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
      Open

      function httpServiceFactory(
          eventsProtocol,
          configuration,
          lookupService,
          swagger,
      Severity: Minor
      Found in lib/services/http-service.js - About 6 hrs 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 dataFactory has 154 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var dataFactory = function(identifier, dataName) {
          switch(dataName)  {
              case 'catData':
                  return nodeApi.getNodeCatalogSourceById(identifier, 'ohai')
                      .then(function(catalog) {
      Severity: Major
      Found in lib/api/redfish-1.0/chassis.js - About 6 hrs to fix

        Function NodeFactory has 142 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function NodeFactory (
            Promise,
            Serializable,
            ObmSerializable,
            SnmpSerializable,
        Severity: Major
        Found in lib/serializables/v1/node.js - About 5 hrs to fix

          Function pollerApiServiceFactory has 137 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function pollerApiServiceFactory(
              waterline,
              taskProtocol,
              Errors,
              _,
          Severity: Major
          Found in lib/services/pollers-api-service.js - About 5 hrs to fix

            File update-service.js has 391 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // Copyright © 2017 Dell Inc. or its subsidiaries.  All Rights Reserved.
            
            'use strict';
            
            var xmlParser = require('xml2js').parseString;
            Severity: Minor
            Found in lib/api/redfish-1.0/update-service.js - About 5 hrs to fix

              Function listSystemEthernetInterfacesById has 133 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Function NotificationApiServiceFactory has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                Open

                function NotificationApiServiceFactory(
                    eventsProtocol,
                    Logger,
                    waterline,
                    Errors,
                Severity: Minor
                Found in lib/services/notification-api-service.js - About 5 hrs 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 prepareGrunt has 127 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function prepareGrunt(grunt) {
                    var allFiles = [
                        'package.json',
                        'Gruntfile.js',
                        'lib/**/*.js',
                Severity: Major
                Found in Gruntfile.js - About 5 hrs to fix

                  File swagger-api-service.js has 372 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  // Copyright 2016, EMC, Inc.
                  
                  'use strict';
                  
                  var di = require('di');
                  Severity: Minor
                  Found in lib/services/swagger-api-service.js - About 4 hrs to fix

                    Function selTranslator has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    var selTranslator = function(selArray, identifier) {
                        var dateRegex = /(\d{1,2})\/(\d{1,2})\/(\d{4})/;
                        var timeRegex = /(\d{1,2}):(\d{1,2}):(\d{1,2})/;
                        var ipmiEventTypeMap = {
                            'Asserted': 'Assert',
                    Severity: Major
                    Found in lib/api/redfish-1.0/systems.js - About 4 hrs to fix

                      Function getChassis has 109 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      var getChassis = controller(function(req, res) {
                          var chassisId = req.swagger.params.identifier.value.split('.')[0];
                          var systemId = req.swagger.params.identifier.value.split('.')[1];
                          var typeEnum = [
                              "Rack",
                      Severity: Major
                      Found in lib/api/redfish-1.0/chassis.js - About 4 hrs to fix

                        File http-service.js has 341 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        // Copyright 2015, EMC, Inc.
                        
                        'use strict';
                        
                        var di = require('di');
                        Severity: Minor
                        Found in lib/services/http-service.js - About 4 hrs to fix

                          Function staticFilesApiServiceFactory has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function staticFilesApiServiceFactory(
                              constants,
                              Logger,
                              Promise,
                              configuration,
                          Severity: Major
                          Found in lib/services/static-files-api-service.js - About 4 hrs to fix

                            Function addVolume has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            var addVolume = controller(function(req,res) {
                                var identifier = req.swagger.params.identifier.value;
                                var payload = req.swagger.params.payload.value;
                                var graphName = 'Graph.Dell.Wsman.Add.Volume';
                                var graphOptions = {
                            Severity: Major
                            Found in lib/api/redfish-1.0/systems.js - About 4 hrs to fix

                              Function schemaApiServiceFactory has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function schemaApiServiceFactory(
                                  configuration,
                                  Logger,
                                  Promise,
                                  _,
                              Severity: Major
                              Found in lib/services/schema-api-service.js - About 3 hrs to fix

                                Function create has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                                Open

                                module.exports = function create(__, ___, injector) {
                                    injector = injector || require('../../index.js').injector;
                                    var _ = injector.get('_');
                                    var swaggerService = injector.get('Http.Services.Swagger');
                                    var conf = injector.get('Services.Configuration');
                                Severity: Minor
                                Found in lib/fittings/error_handler.js - About 3 hrs 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 getManager has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                var getManager = controller(function(req, res) {
                                    var identifier = req.swagger.params.identifier.value;
                                    var options = redfish.makeOptions(req, res, identifier);
                                    return redfish.getVendorNameById(identifier)
                                    .catch(function() {return{};})
                                Severity: Major
                                Found in lib/api/redfish-1.0/managers.js - About 3 hrs to fix

                                  Function eventCallback has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  var eventCallback = function(events) {
                                      var clients;
                                      if(_.isArray(events.value)) {
                                          return _.forEach(events.value, function(event) {
                                              if(event.reading.sdrType === 'Threshold') {
                                  Severity: Major
                                  Found in lib/api/redfish-1.0/event-service.js - About 3 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language