RackHD/on-http

View on GitHub

Showing 440 of 440 total issues

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

    TaskgraphApiService.prototype.postTaskById = function(identifier, body) {
        return runRpc('postTaskById', {
            identifier: identifier,
            config: JSON.stringify(body)
        });
Severity: Minor
Found in lib/services/taskgraph-api-service.js and 1 other location - About 40 mins to fix
lib/services/taskgraph-api-service.js on lines 180..185

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

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

    TaskgraphApiService.prototype.workflowsPost = function(config, nodeId) {
        return runRpc('workflowsPost', {
            nodeId: nodeId, 
            configuration: JSON.stringify(config)
        });
Severity: Minor
Found in lib/services/taskgraph-api-service.js and 1 other location - About 40 mins to fix
lib/services/taskgraph-api-service.js on lines 145..150

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

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 nodesGetCatalogById = controller(function(req) {
    return nodes.getNodeCatalogById(req.swagger.params.identifier.value, req.query);
});
Severity: Minor
Found in lib/api/2.0/nodes.js and 1 other location - About 40 mins to fix
lib/api/2.0/nodes.js on lines 33..35

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

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 nodesPatchById = controller(function(req) {
    return nodes.patchNodeById(req.swagger.params.identifier.value, req.body);
});
Severity: Minor
Found in lib/api/2.0/nodes.js and 1 other location - About 40 mins to fix
lib/api/2.0/nodes.js on lines 49..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 49.

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

Consider simplifying this complex logical expression.
Open

            if (credentials !== undefined
                && context.request.method === "PUT"
                && context.request.originalUrl === "/api/2.0/ibms"
                && context.request.body.config !== undefined
                && context.request.body.config.user === undefined
Severity: Major
Found in lib/fittings/rackhd_validator.js - About 40 mins to fix

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

    var hooksGetById = controller(function(req) {
        return hooks.getHookById(req.swagger.params.identifier.value);
    });
    Severity: Major
    Found in lib/api/2.0/hooks.js and 7 other locations - About 40 mins to fix
    lib/api/2.0/catalogs.js on lines 25..27
    lib/api/2.0/pollers.js on lines 41..43
    lib/api/2.0/pollers.js on lines 83..85
    lib/api/2.0/skus.js on lines 17..19
    lib/api/2.0/skus.js on lines 35..37
    lib/api/2.0/skus.js on lines 53..55
    lib/api/2.0/workflowTasks.js on lines 48..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 48.

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

    var skusGet = controller(function (req) {
         return skuPack.getSkus(req.swagger.params.query.value);
    });
    Severity: Major
    Found in lib/api/2.0/skus.js and 7 other locations - About 40 mins to fix
    lib/api/2.0/catalogs.js on lines 25..27
    lib/api/2.0/hooks.js on lines 25..27
    lib/api/2.0/pollers.js on lines 41..43
    lib/api/2.0/pollers.js on lines 83..85
    lib/api/2.0/skus.js on lines 35..37
    lib/api/2.0/skus.js on lines 53..55
    lib/api/2.0/workflowTasks.js on lines 48..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 48.

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

    var pollersIdGet = controller(function(req) {
        return pollers.getPollersById(req.swagger.params.identifier.value);
    });
    Severity: Major
    Found in lib/api/2.0/pollers.js and 7 other locations - About 40 mins to fix
    lib/api/2.0/catalogs.js on lines 25..27
    lib/api/2.0/hooks.js on lines 25..27
    lib/api/2.0/pollers.js on lines 41..43
    lib/api/2.0/skus.js on lines 17..19
    lib/api/2.0/skus.js on lines 35..37
    lib/api/2.0/skus.js on lines 53..55
    lib/api/2.0/workflowTasks.js on lines 48..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 48.

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

    var catalogsIdGet = controller(function(req) {
        return catalogs.getCatalogById(req.swagger.params.identifier.value);
    });
    Severity: Major
    Found in lib/api/2.0/catalogs.js and 7 other locations - About 40 mins to fix
    lib/api/2.0/hooks.js on lines 25..27
    lib/api/2.0/pollers.js on lines 41..43
    lib/api/2.0/pollers.js on lines 83..85
    lib/api/2.0/skus.js on lines 17..19
    lib/api/2.0/skus.js on lines 35..37
    lib/api/2.0/skus.js on lines 53..55
    lib/api/2.0/workflowTasks.js on lines 48..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 48.

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

    var workflowsGetTasksByName = controller(function(req) {
        return workflowApiService.getWorkflowsTasksByName(req.swagger.params.injectableName.value);
    });
    Severity: Major
    Found in lib/api/2.0/workflowTasks.js and 7 other locations - About 40 mins to fix
    lib/api/2.0/catalogs.js on lines 25..27
    lib/api/2.0/hooks.js on lines 25..27
    lib/api/2.0/pollers.js on lines 41..43
    lib/api/2.0/pollers.js on lines 83..85
    lib/api/2.0/skus.js on lines 17..19
    lib/api/2.0/skus.js on lines 35..37
    lib/api/2.0/skus.js on lines 53..55

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

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

    var skusIdGetNodes = controller(function(req) {
        return   skuPack.getNodesSkusById(req.swagger.params.identifier.value);
    });
    Severity: Major
    Found in lib/api/2.0/skus.js and 7 other locations - About 40 mins to fix
    lib/api/2.0/catalogs.js on lines 25..27
    lib/api/2.0/hooks.js on lines 25..27
    lib/api/2.0/pollers.js on lines 41..43
    lib/api/2.0/pollers.js on lines 83..85
    lib/api/2.0/skus.js on lines 17..19
    lib/api/2.0/skus.js on lines 35..37
    lib/api/2.0/workflowTasks.js on lines 48..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 48.

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

    var pollersLibByIdGet = controller(function(req) {
        return pollers.getPollerLibById(req.swagger.params.identifier.value);
    });
    Severity: Major
    Found in lib/api/2.0/pollers.js and 7 other locations - About 40 mins to fix
    lib/api/2.0/catalogs.js on lines 25..27
    lib/api/2.0/hooks.js on lines 25..27
    lib/api/2.0/pollers.js on lines 83..85
    lib/api/2.0/skus.js on lines 17..19
    lib/api/2.0/skus.js on lines 35..37
    lib/api/2.0/skus.js on lines 53..55
    lib/api/2.0/workflowTasks.js on lines 48..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 48.

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

    var skusIdGet = controller( function (req) {
        return   skuPack.getSkusById(req.swagger.params.identifier.value);
    });
    Severity: Major
    Found in lib/api/2.0/skus.js and 7 other locations - About 40 mins to fix
    lib/api/2.0/catalogs.js on lines 25..27
    lib/api/2.0/hooks.js on lines 25..27
    lib/api/2.0/pollers.js on lines 41..43
    lib/api/2.0/pollers.js on lines 83..85
    lib/api/2.0/skus.js on lines 17..19
    lib/api/2.0/skus.js on lines 53..55
    lib/api/2.0/workflowTasks.js on lines 48..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 48.

    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

        var message = _.defaults(req.swagger.query || {}, req.query || {}, req.body || {});
    Severity: Minor
    Found in lib/api/2.0/notification.js and 2 other locations - About 40 mins to fix
    lib/api/2.0/notification.js on lines 28..28
    lib/services/notification-api-service.js on lines 172..172

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

    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

        var message = _.defaults(req.swagger.query || {}, req.query || {}, req.body || {});
    Severity: Minor
    Found in lib/api/2.0/notification.js and 2 other locations - About 40 mins to fix
    lib/api/2.0/notification.js on lines 13..13
    lib/services/notification-api-service.js on lines 172..172

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

    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

            var alert = _.defaults(req.swagger.query || {},req.query || {}, req.body || {});
    Severity: Minor
    Found in lib/services/notification-api-service.js and 2 other locations - About 40 mins to fix
    lib/api/2.0/notification.js on lines 13..13
    lib/api/2.0/notification.js on lines 28..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 48.

    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 staticFilesApiServiceFactory has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        constants,
        Logger,
        Promise,
        configuration,
        waterline
    Severity: Minor
    Found in lib/services/static-files-api-service.js - About 35 mins to fix

      Function schemaApiServiceFactory has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          configuration,
          Logger,
          Promise,
          _,
          nodeFs
      Severity: Minor
      Found in lib/services/schema-api-service.js - About 35 mins to fix

        Function getSoftFwInventory has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function getSoftFwInventory(options, identifier, pathsLookups, keyMatch, matchComponent) {
        Severity: Minor
        Found in lib/api/redfish-1.0/update-service.js - About 35 mins to fix

          Function obmApiServiceFactory has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              waterline,
              Logger,
              eventsProtocol,
              Promise,
              _
          Severity: Minor
          Found in lib/services/obm-api-service.js - About 35 mins to fix
            Severity
            Category
            Status
            Source
            Language