RackHD/on-http

View on GitHub

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

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

              if(result.vendor === 'Dell'){
                  options.type = 'LC';
                  options.description = 'iDRAC Lifecycle Controller Log';
                  options.name = 'idrac-lc-information';
                  options.log = {};
      Severity: Major
      Found in lib/api/redfish-1.0/systems.js and 1 other location - About 6 hrs to fix
      lib/api/redfish-1.0/systems.js on lines 1340..1373

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

      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'){
                  options.type = 'SEL';
                  options.description = 'iDRAC System Event Log';
                  options.name = 'idrac-sel-information';
                  options.log = {};
      Severity: Major
      Found in lib/api/redfish-1.0/systems.js and 1 other location - About 6 hrs to fix
      lib/api/redfish-1.0/systems.js on lines 1498..1516

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

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

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

          var getFirmwareInventoryList = controller({success: 200}, function (req, res) {
              var options = redfish.makeOptions(req, res);
              var matchComponent = "FRMW";
              var keyMatch = Object.keys(fwPathsLookups);
              return getVersions(options.url, keyMatch, matchComponent)
          Severity: Major
          Found in lib/api/redfish-1.0/update-service.js and 1 other location - About 5 hrs to fix
          lib/api/redfish-1.0/update-service.js on lines 177..191

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

          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 getSoftwareInventoryList = controller({success: 200}, function (req, res) {
              var options = redfish.makeOptions(req, res);
              var matchComponent = "APAC";
              var keyMatch = Object.keys(swPathsLookups);
              return getVersions(options.url, keyMatch, matchComponent)
          Severity: Major
          Found in lib/api/redfish-1.0/update-service.js and 1 other location - About 5 hrs to fix
          lib/api/redfish-1.0/update-service.js on lines 193..207

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

          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 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
                              Severity
                              Category
                              Status
                              Source
                              Language