RackHD/on-http

View on GitHub

Showing 440 of 440 total issues

Function factory has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

function factory(Promise, Errors, waterline, uuid, assert,  _, fs) {
Severity: Major
Found in lib/services/files/file-plugin.js - About 50 mins to fix

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

    var ibmsGetById = controller(function(req) {
        return waterline.ibms.needByIdentifier(req.swagger.params.identifier.value);
    });
    Severity: Minor
    Found in lib/api/2.0/ibms.js and 1 other location - About 50 mins to fix
    lib/api/2.0/obms.js on lines 43..45

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

    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 obmsGetById = controller(function(req) {
        return waterline.obms.needByIdentifier(req.swagger.params.identifier.value);
    });
    Severity: Minor
    Found in lib/api/2.0/obms.js and 1 other location - About 50 mins to fix
    lib/api/2.0/ibms.js on lines 28..30

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

    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

            return waterline.obms.needByIdentifier(obmId)
            .then(function (obm) {
                return waterline.nodes.getNodeById(obm.node);
            })
            .then(function (oldNode) {
    Severity: Minor
    Found in lib/services/obm-api-service.js and 1 other location - About 50 mins to fix
    lib/api/2.0/ibms.js on lines 73..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 51.

    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 getRole = controller(function (req) {
        var name = req.swagger.params.name.value;
        return accountService.getRoleByName(name);
    });
    Severity: Minor
    Found in lib/api/2.0/roles2.0.js and 1 other location - About 50 mins to fix
    lib/api/2.0/users.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 51.

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

            return Promise.try(function () {
                assert.string(name);
                return waterline.roles.findOne({ role: name });
            })
            .then(function (entry) {
    Severity: Major
    Found in lib/services/account-api-service.js and 3 other locations - About 50 mins to fix
    lib/services/account-api-service.js on lines 105..119
    lib/services/account-api-service.js on lines 151..163
    lib/services/account-api-service.js on lines 229..241

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

    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

        return waterline.ibms.needByIdentifier(ibmId)
            .then(function (ibm) {
                return waterline.nodes.getNodeById(ibm.node);
            })
            .then(function (oldNode) {
    Severity: Minor
    Found in lib/api/2.0/ibms.js and 1 other location - About 50 mins to fix
    lib/services/obm-api-service.js on lines 299..317

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

    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(info.role && info.role !== entry.role) {
                    return [entry, self.aclMethod('removeUserRoles', entry.username, entry.role)];
                }
    Severity: Minor
    Found in lib/services/account-api-service.js and 1 other location - About 50 mins to fix
    lib/services/account-api-service.js on lines 168..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 51.

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

            return Promise.try(function() {
                assert.string(name);
                return waterline.localusers.findOne({username: name});
            })
            .then(function(entry) {
    Severity: Major
    Found in lib/services/account-api-service.js and 3 other locations - About 50 mins to fix
    lib/services/account-api-service.js on lines 105..119
    lib/services/account-api-service.js on lines 229..241
    lib/services/account-api-service.js on lines 281..290

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

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

            return Promise.try(function () {
                assert.string(name);
                return waterline.roles.findOne({ role: name });
            })
            .then(function (roleFound) {
    Severity: Major
    Found in lib/services/account-api-service.js and 3 other locations - About 50 mins to fix
    lib/services/account-api-service.js on lines 105..119
    lib/services/account-api-service.js on lines 151..163
    lib/services/account-api-service.js on lines 281..290

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

    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(info.role && info.role !== entry.role) {
                    return [entry, self.aclMethod('addUserRoles', entry.username, info.role)];
                }
    Severity: Minor
    Found in lib/services/account-api-service.js and 1 other location - About 50 mins to fix
    lib/services/account-api-service.js on lines 159..161

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

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

            return Promise.try(function() {
                assert.string(username);
                return waterline.localusers.findOne({username: username});
            })
            .then(function(user) {
    Severity: Major
    Found in lib/services/account-api-service.js and 3 other locations - About 50 mins to fix
    lib/services/account-api-service.js on lines 151..163
    lib/services/account-api-service.js on lines 229..241
    lib/services/account-api-service.js on lines 281..290

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

    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 getUser = controller(function(req) {
        var name = req.swagger.params.name.value;
        return accountService.getUserByName(name);
    });
    Severity: Minor
    Found in lib/api/2.0/users.js and 1 other location - About 50 mins to fix
    lib/api/2.0/roles2.0.js on lines 25..28

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

    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

    Avoid deeply nested control flow statements.
    Open

                                if (typeof options.ipv6 !== "undefined") {
                                    delete options.ipv6;
                                }
    Severity: Major
    Found in lib/api/redfish-1.0/systems.js - About 45 mins to fix

      Function getSessions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      var getSessions = controller(function(req, res) {
          var options = redfish.makeOptions(req, res);
          options.sessions = _.filter(auth.getRedfishSession(), function(session) {
              if( req.isAuthenticated && req.isAuthenticated() ) {
                  if( req.hasRole('Administrator') || req.hasRole('ConfigureUsers') ||
      Severity: Minor
      Found in lib/api/redfish-1.0/session-service.js - About 45 mins 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

      Avoid deeply nested control flow statements.
      Open

                              if (fwTypes[FWType] === undefined) {
                                  fwTypes[FWType] = [entry];
                              } else {
                                  fwTypes[FWType].push(entry);
                              }
      Severity: Major
      Found in lib/api/redfish-1.0/update-service.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                        if (typeof options.ipv4 === 'undefined' ) {
                                            options.ipv4 = [];
                                        }
        Severity: Major
        Found in lib/api/redfish-1.0/systems.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                          if (typeof options.ipv6 === 'undefined' ) {
                                              options.ipv6 = [];
                                          }
          Severity: Major
          Found in lib/api/redfish-1.0/systems.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                            if (
                                                parseInt(alertDiskSlot) === parseInt(catalogedComponentDiskSlot)
                                                && !foundComponent) {
                                                foundComponent = true;
                                                amqpMessage = updateSnPn(amqpMessage, catalogedComponent);
            Severity: Major
            Found in lib/services/notification-api-service.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if (fwTypes[FWType] === undefined) {
                                              fwTypes[FWType] = [entry];
                                          } else {
                                              fwTypes[FWType].push(entry);
                                          }
              Severity: Major
              Found in lib/api/redfish-1.0/update-service.js - About 45 mins to fix
                Severity
                Category
                Status
                Source
                Language