RackHD/on-http

View on GitHub

Showing 440 of 440 total issues

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

        var config = _.defaults(
            req.swagger.params.name.value ? { name: req.swagger.params.name.value } : {},
            req.swagger.params.body.value || {}
        );
Severity: Major
Found in lib/api/2.0/tags.js and 1 other location - About 2 hrs to fix
lib/api/2.0/nodes.js on lines 83..86

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

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 fs.readdirAsync(fromRoot)
        .filter(function(entry) {
            return fs.statSync(fromRoot + '/' + entry).isFile();
        })
        .map(function(entry) {
Severity: Major
Found in lib/services/sku-pack-service.js and 1 other location - About 2 hrs to fix
lib/services/sku-pack-service.js on lines 641..647

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

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

var getNetwork = controller(function(req, res) {
    //var redfishId = redfish.isRedfish(req.swagger.params.identifier.value);
    var identifier = req.swagger.params.identifier.value;

    return redfish.getVendorNameById(identifier)
Severity: Major
Found in lib/api/redfish-1.0/networks.js - About 2 hrs to fix

    Function skuPackHandler has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        SkuPackService.prototype.skuPackHandler = function(req,res,skuid) {
            var self = this;
            var name = uuid('v4');
            var tmpDir = tmp();
    
    
    Severity: Major
    Found in lib/services/sku-pack-service.js - About 2 hrs to fix

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

                          {
                              host: {
                                  default: 'localhost',
                                  type: 'string'
                              },
      Severity: Major
      Found in lib/services/obm-api-service.js and 1 other location - About 2 hrs to fix
      lib/services/obm-api-service.js on lines 171..192

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

      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

                          {
                              host: {
                                  default: 'localhost',
                                  type: 'string'
                              },
      Severity: Major
      Found in lib/services/obm-api-service.js and 1 other location - About 2 hrs to fix
      lib/services/obm-api-service.js on lines 149..170

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

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

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

        Function obmApiServiceFactory has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        function obmApiServiceFactory(
            waterline,
            Logger,
            eventsProtocol,
            Promise,
        Severity: Minor
        Found in lib/services/obm-api-service.js - About 2 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 _setup has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            HttpService.prototype._setup =  function() {
                var app = this.app;
                var endpoint = this.endpoint;
        
                // CORS Support
        Severity: Major
        Found in lib/services/http-service.js - About 2 hrs to fix

          Function deleteVolume has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Function getSystemProcessor has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Function resetSystemBios has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var resetSystemBios = controller(function(req, res)  {
                  var identifier = req.swagger.params.identifier.value;
                  var options = redfish.makeOptions(req, res, identifier);
                  var payload = req.swagger.params.payload.value;
              
              
              Severity: Major
              Found in lib/api/redfish-1.0/systems.js - About 2 hrs to fix

                Function removeNode has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    NodeApiService.prototype.removeNode = function(node, srcType) {
                        var self = this;
                        return self._delValidityCheck(node.id)
                        .then(function () {
                            if (!node.hasOwnProperty('relations')) {
                Severity: Major
                Found in lib/services/nodes-api-service.js - About 2 hrs to fix

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

                                      return redfish.validateSchema(record, 'Event.v1_1_2.json#/definitions/EventRecord') //jshint ignore: line
                                      .then(function(result) {
                                          if(result.error) {
                                              throw new Error(result.error);
                                          }
                  Severity: Major
                  Found in lib/api/redfish-1.0/event-service.js and 2 other locations - About 2 hrs to fix
                  lib/api/redfish-1.0/event-service.js on lines 77..86
                  lib/api/redfish-1.0/event-service.js on lines 135..144

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

                  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

                                  ucsPowerThermalData.map(function(item) {
                                      options.voltageList.push(
                                          {
                                              'sensorId': item.dn.split('/').slice(0, -1).join('/'),
                                              'sensorReading': item.input_voltage
                  Severity: Major
                  Found in lib/api/redfish-1.0/chassis.js and 2 other locations - About 2 hrs to fix
                  lib/api/redfish-1.0/chassis.js on lines 380..387
                  lib/api/redfish-1.0/chassis.js on lines 463..470

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

                  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

                                  ucsPsuData.map(function(item) {
                                      options.wattsList.push(
                                          {
                                              'sensorId': item.dn.split('/').slice(0, -1).join('/'),
                                              'sensorReading': item.psu_wattage
                  Severity: Major
                  Found in lib/api/redfish-1.0/chassis.js and 2 other locations - About 2 hrs to fix
                  lib/api/redfish-1.0/chassis.js on lines 380..387
                  lib/api/redfish-1.0/chassis.js on lines 455..462

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

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

                                      return redfish.validateSchema(record, 'Event.v1_1_2.json#/definitions/EventRecord') //jshint ignore: line
                                      .then(function(result) {
                                          if(result.error) {
                                              throw new Error(result.error);
                                          }
                  Severity: Major
                  Found in lib/api/redfish-1.0/event-service.js and 2 other locations - About 2 hrs to fix
                  lib/api/redfish-1.0/event-service.js on lines 105..114
                  lib/api/redfish-1.0/event-service.js on lines 135..144

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

                  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

                                  ucsFanData.map(function (item) {
                                      options.fanList.push(
                                          {
                                              'sensorId': item.dn.split('/').slice(0, -1).join('/'),
                                              'sensorReading': item.speed
                  Severity: Major
                  Found in lib/api/redfish-1.0/chassis.js and 2 other locations - About 2 hrs to fix
                  lib/api/redfish-1.0/chassis.js on lines 455..462
                  lib/api/redfish-1.0/chassis.js on lines 463..470

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

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

                                      return redfish.validateSchema(record, 'Event.v1_1_2.json#/definitions/EventRecord') //jshint ignore: line
                                      .then(function(result) {
                                          if(result.error) {
                                              throw new Error(result.error);
                                          }
                  Severity: Major
                  Found in lib/api/redfish-1.0/event-service.js and 2 other locations - About 2 hrs to fix
                  lib/api/redfish-1.0/event-service.js on lines 77..86
                  lib/api/redfish-1.0/event-service.js on lines 105..114

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

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

                  var dataFactory = function(identifier, dataName) {
                      switch(dataName)  {
                          case 'catData':
                              return Promise.all([nodeApi.getNodeCatalogSourceById(identifier,'ohai'), nodeApi.getNodeCatalogSourceById(identifier,'dmi')])
                                  .spread(function(ohai, dmi) {
                  Severity: Major
                  Found in lib/api/redfish-1.0/systems.js - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language