RackHD/on-http

View on GitHub

Showing 440 of 440 total issues

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

var obmsDefinitionsGetByName = controller(function(req) {
    var schemaUid = nameSpace + req.swagger.params.name.value;
    var schema = schemaApiService.getSchema(schemaUid);
    if (schema) {
        return schema;
Severity: Major
Found in lib/api/2.0/obms.js and 1 other location - About 2 hrs to fix
lib/api/2.0/schemas2.js on lines 20..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 88.

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

var listSimpleStorage = 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 wsmanServiceFactory has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function wsmanServiceFactory(
        waterline,
        encryption,
        configuration,
        WsmanTool,
    Severity: Major
    Found in lib/services/wsman-service.js - About 2 hrs to fix

      File obm-api-service.js has 276 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/obm-api-service.js - About 2 hrs to fix

        Function installPack has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            SkuPackService.prototype.installPack = function(fromRoot, skuid) {
                var self = this;
                var contents;
                return fs.readFileAsync(fromRoot + '/config.json')
                .then(function(fileContents) {
        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

                  case 'chassis':
                      return nodeApi.getNodeByIdentifier(identifier)
                      .then(function(node) {
                          return _.filter(node.relations, function(relation) {
                              return relation.relationType === 'enclosedBy';
          Severity: Major
          Found in lib/api/redfish-1.0/systems.js and 1 other location - About 2 hrs to fix
          lib/api/redfish-1.0/chassis.js on lines 83..91

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

          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

                  case 'system':
                      return nodeApi.getNodeById(identifier)
                      .then(function(node) {
                          return _.filter(node.relations, function(relation) {
                              return relation.relationType === 'encloses';
          Severity: Major
          Found in lib/api/redfish-1.0/chassis.js and 1 other location - About 2 hrs to fix
          lib/api/redfish-1.0/systems.js on lines 30..38

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

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

              NodeApiService.prototype.postNode = function(body) {
                  var nodeBody = _.omit(body, ['obms', 'ibms']);
                  var obmBody = body.obms || body.obmSettings || null;
                  var ibmBody = body.ibms || null;
          
          
          Severity: Major
          Found in lib/services/nodes-api-service.js - About 2 hrs to fix

            Function getDrive has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Function addHotspare has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Function getSerialNumber has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function getSerialNumber(amqpMessage) {
                        //amqpMessage.data.originOfCondition = "Disk.Bay.1-0";
                        if (amqpMessage.data.OriginOfCondition !== null && amqpMessage.data.OriginOfCondition  !== undefined) {
                        var diskType;
                        var splitAlertName = amqpMessage.data.OriginOfCondition.split(".");
                Severity: Major
                Found in lib/services/notification-api-service.js - About 2 hrs to fix

                  Function listStorage has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Function addRelation has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        NodeApiService.prototype.addRelation = function addRelation(node, type, targets) {
                            if (!(node && type && targets)) {
                                return;
                            }
                            return waterline.nodes.addFieldIfNotExistByIdentifier(node.id, "relations", [])
                    Severity: Major
                    Found in lib/services/nodes-api-service.js - About 2 hrs to fix

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

                                  return Promise.try(function() {
                                      assert.string(identifier, 'invalid identifier specified: ' + identifier);
                                      return waterline.nodes.needByIdentifier(identifier);
                                  })
                                  .then(function(node) {
                      Severity: Major
                      Found in lib/api/redfish-1.0/managers.js and 1 other location - About 2 hrs to fix
                      lib/api/redfish-1.0/managers.js on lines 329..340

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

                      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

                                                  case "inet6":
                                                      if (typeof options.ipv6 === 'undefined' ) {
                                                          options.ipv6 = [];
                                                      }
                                                      var ip6 = {
                      Severity: Major
                      Found in lib/api/redfish-1.0/systems.js and 1 other location - About 2 hrs to fix
                      lib/api/redfish-1.0/systems.js on lines 1842..1852

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

                      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

                                                  case "inet":
                      
                                                      if (typeof options.ipv4 === 'undefined' ) {
                                                          options.ipv4 = [];
                                                      }
                      Severity: Major
                      Found in lib/api/redfish-1.0/systems.js and 1 other location - About 2 hrs to fix
                      lib/api/redfish-1.0/systems.js on lines 1853..1862

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

                      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.try(function() {
                                      assert.string(identifier, 'invalid identifier specified: ' + identifier);
                                      return waterline.nodes.needByIdentifier(identifier);
                                  })
                                  .then(function(node) {
                      Severity: Major
                      Found in lib/api/redfish-1.0/managers.js and 1 other location - About 2 hrs to fix
                      lib/api/redfish-1.0/managers.js on lines 292..308

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

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

                          function _render(viewName, req, res) {
                              var options;
                      
                              return Promise.try(function() {
                                  assert.optionalString(viewName);
                      Severity: Major
                      Found in lib/services/swagger-api-service.js - About 2 hrs to fix

                        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 631..637

                        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

                            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/nodes.js and 1 other location - About 2 hrs to fix
                        lib/api/2.0/tags.js on lines 48..51

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language