RackHD/on-http

View on GitHub

Showing 440 of 440 total issues

Function accountApiServiceFactory has 251 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function accountApiServiceFactory(
    waterline,
    Errors,
    Logger,
    _,
Severity: Major
Found in lib/services/account-api-service.js - About 1 day to fix

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

    var listDCIMCoolingDomain = controller(function (req, res) {
        var options = redfish.makeOptions(req, res);
        options.domain = req.swagger.params.domain.value;
    
        return waterline.nodes.find({type: 'cooling'}).then(function (nodes) {
    Severity: Major
    Found in lib/api/redfish-1.0/dcimcooling.js and 1 other location - About 1 day to fix
    lib/api/redfish-1.0/dcimpower.js on lines 13..34

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

    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 listDCIMPowerDomain = controller(function (req, res) {
        var options = redfish.makeOptions(req, res);
        options.domain = req.swagger.params.domain.value;
    
        return waterline.nodes.find({type: 'power'}).then(function (nodes) {
    Severity: Major
    Found in lib/api/redfish-1.0/dcimpower.js and 1 other location - About 1 day to fix
    lib/api/redfish-1.0/dcimcooling.js on lines 13..32

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

    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 'ucsThermal':
                var ucsThermalPollerData = {};
                var ucsThermalKeyMap = {
                    'ucs.powerthermal': 'computeMbTempStats',
                    'ucs.fan': 'equipmentFanStats'
    Severity: Major
    Found in lib/api/redfish-1.0/chassis.js and 1 other location - About 1 day to fix
    lib/api/redfish-1.0/chassis.js on lines 175..195

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

    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 'ucsPower':
                var ucsPowerPollerData = {};
                var ucsPowerKeyMap = {
                    'ucs.powerthermal': 'computeMbPowerStats',
                    'ucs.psu': 'equipmentPsuStats'
    Severity: Major
    Found in lib/api/redfish-1.0/chassis.js and 1 other location - About 1 day to fix
    lib/api/redfish-1.0/chassis.js on lines 153..174

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

    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

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

    // Copyright © 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
    
    'use strict';
    
    var di = require('di');
    Severity: Major
    Found in lib/services/nodes-api-service.js - About 1 day to fix

      File sku-pack-service.js has 564 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Copyright 2015, EMC, Inc.
      
      'use strict';
      
      var di = require('di'),
      Severity: Major
      Found in lib/services/sku-pack-service.js - About 1 day to fix

        Function taskgraphApiServiceFactory has 232 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function taskgraphApiServiceFactory(
            Errors,
            configuration,
            Promise,
            _
        Severity: Major
        Found in lib/services/taskgraph-api-service.js - About 1 day to fix

          Function swaggerFactory has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
          Open

          function swaggerFactory(
              Promise,
              Errors,
              _,
              injector,
          Severity: Minor
          Found in lib/services/swagger-api-service.js - About 1 day 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 restFactory has 217 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function restFactory(
              Serializable,
              Promise,
              _,
              assert,
          Severity: Major
          Found in lib/services/rest-api-service.js - About 1 day to fix

            Function restFactory has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
            Open

            function restFactory(
                Serializable,
                Promise,
                _,
                assert,
            Severity: Minor
            Found in lib/services/rest-api-service.js - About 1 day 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

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

                TemplateApiService.prototype.FileStreaming = function (filename, stream) {
                    var contents = '';
                    var resolve;
                    var reject;
                    var hash = crypto.createHash('md5');
            Severity: Major
            Found in lib/services/templates-api-service.js and 1 other location - About 1 day to fix
            lib/services/profiles-api-service.js on lines 47..73

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

            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

                ProfileApiService.prototype.FileStreaming = function (filename, stream) {
                    var contents = '';
                    var resolve;
                    var reject;
                    var hash = crypto.createHash('md5');
            Severity: Major
            Found in lib/services/profiles-api-service.js and 1 other location - About 1 day to fix
            lib/services/templates-api-service.js on lines 51..77

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

            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

            File managers.js has 510 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // Copyright 2016, EMC, Inc.
            
            'use strict';
            
            var injector = require('../../../index.js').injector;
            Severity: Major
            Found in lib/api/redfish-1.0/managers.js - About 1 day to fix

              Function authServiceFactory has 200 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function authServiceFactory(
                  assert,
                  configuration,
                  _,
                  waterline
              Severity: Major
              Found in lib/services/auth-service.js - About 1 day to fix

                File chassis.js has 486 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                // Copyright 2016, EMC, Inc.
                
                'use strict';
                
                var injector = require('../../../index.js').injector;
                Severity: Minor
                Found in lib/api/redfish-1.0/chassis.js - About 7 hrs to fix

                  Function UPnPServiceFactory has 189 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function UPnPServiceFactory(
                      _,
                      waterline,
                      Logger,
                      Profiles,
                  Severity: Major
                  Found in lib/services/upnp-service.js - About 7 hrs to fix

                    Function redfishApiServiceFactory has 188 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

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

                      var listDCIMPowerDomainCollection = controller(function (req, res) {
                          var options = redfish.makeOptions(req, res);
                          return waterline.nodes.find({type: 'power'}).then(function (nodes) {
                              options.nodes = nodes;
                              var domains = [];
                      Severity: Major
                      Found in lib/api/redfish-1.0/dcimpower.js and 1 other location - About 7 hrs to fix
                      lib/api/redfish-1.0/dcimcooling.js on lines 35..50

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

                      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 listDCIMCoolingDomainCollection = controller(function (req, res) {
                          var options = redfish.makeOptions(req, res);
                          return waterline.nodes.find({type: 'cooling'}).then(function (nodes) {
                              options.nodes = nodes;
                              var domains = [];
                      Severity: Major
                      Found in lib/api/redfish-1.0/dcimcooling.js and 1 other location - About 7 hrs to fix
                      lib/api/redfish-1.0/dcimpower.js on lines 36..52

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

                      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