RouteInjector/route-injector

View on GitHub
lib/engine/routeinjector/typeBased/typeBased.js

Summary

Maintainability
F
1 wk
Test Coverage

Function postArrayElementAt has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

module.exports.postArrayElementAt = function (Model, key) {

    return function (req, res) {
        var gConfig = Model.injector();
        var field = gConfig.id;
Severity: Minor
Found in lib/engine/routeinjector/typeBased/typeBased.js - About 6 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function appendArrayElement has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

module.exports.appendArrayElement = function (Model, key) {

    return function (req, res) {
        var gConfig = Model.injector();
        var field = gConfig.id;
Severity: Minor
Found in lib/engine/routeinjector/typeBased/typeBased.js - About 6 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File typeBased.js has 357 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var utils = require('../utils');
var statusCode = require('http-status-codes');
var confs = utils.getModels();
var Q = require('q');
Severity: Minor
Found in lib/engine/routeinjector/typeBased/typeBased.js - About 4 hrs to fix

    Function getInvRefField has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports.getInvRefField = function (Model, refModel, field) {
        return function (req, res) {
            var gConfig = Model.injector();
            var config = utils.getConfigByProfile(gConfig.get, req);
            (config.pre) ? utils.runPreCallbacks(config.pre, Model, req, res, mainGetFn) : mainGetFn();
    Severity: Major
    Found in lib/engine/routeinjector/typeBased/typeBased.js - About 2 hrs to fix

      Function postArrayElementAt has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports.postArrayElementAt = function (Model, key) {
      
          return function (req, res) {
              var gConfig = Model.injector();
              var field = gConfig.id;
      Severity: Major
      Found in lib/engine/routeinjector/typeBased/typeBased.js - About 2 hrs to fix

        Function appendArrayElement has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports.appendArrayElement = function (Model, key) {
        
            return function (req, res) {
                var gConfig = Model.injector();
                var field = gConfig.id;
        Severity: Major
        Found in lib/engine/routeinjector/typeBased/typeBased.js - About 2 hrs to fix

          Function mainGetFn has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function mainGetFn() {
                      var query = {};
                      for (var i in config.mongo.query) {
                          //COPY the object
                          query[i] = config.mongo.query[i];
          Severity: Major
          Found in lib/engine/routeinjector/typeBased/typeBased.js - About 2 hrs to fix

            Function getQueriedRefField has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports.getQueriedRefField = function (Model, field, refModel, key) {
            
                return function (req, res) {
                    var gConfig = Model.injector();
                    var config = utils.getConfigByProfile(gConfig.get, req);
            Severity: Major
            Found in lib/engine/routeinjector/typeBased/typeBased.js - About 2 hrs to fix

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

                      function mainPutFn() {
                          //Check incoming Model
                          if (req.body == undefined || req.body.element == undefined) {
                              res.statusCode = statusCode.BAD_REQUEST;
                              res.json("The body must containt the \"element\" key");
              Severity: Major
              Found in lib/engine/routeinjector/typeBased/typeBased.js - About 2 hrs to fix

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

                        function mainPutFn() {
                            //Check incoming Model
                            if (req.body == undefined || req.body.element == undefined) {
                                res.statusCode = statusCode.BAD_REQUEST;
                                res.json("The body must containt the \"element\" key");
                Severity: Major
                Found in lib/engine/routeinjector/typeBased/typeBased.js - About 2 hrs to fix

                  Function getRefField has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports.getRefField = function (Model, field, refModel, key) {
                  
                      return function (req, res) {
                          var gConfig = Model.injector();
                          var config = utils.getConfigByProfile(gConfig.get, req);
                  Severity: Major
                  Found in lib/engine/routeinjector/typeBased/typeBased.js - About 2 hrs to fix

                    Function mainGetFn has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            function mainGetFn() {
                                var query = {};
                                for (var i in config.mongo.query) {
                                    //COPY the object
                                    query[i] = config.mongo.query[i];
                    Severity: Major
                    Found in lib/engine/routeinjector/typeBased/typeBased.js - About 2 hrs to fix

                      Function mainGetFn has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              function mainGetFn() {
                                  var query = {};
                                  for (var i in config.mongo.query) {
                                      //COPY the object
                                      query[i] = config.mongo.query[i];
                      Severity: Major
                      Found in lib/engine/routeinjector/typeBased/typeBased.js - About 2 hrs to fix

                        Function endOK has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                                function endOK() {
                                                    var refConf = confs[refModel.modelName];
                        
                                                    if (refConf.search.disable === true) {
                                                        res.statusCode = statusCode.UNAUTHORIZED;
                        Severity: Minor
                        Found in lib/engine/routeinjector/typeBased/typeBased.js - About 1 hr to fix

                          Function getRefField has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          module.exports.getRefField = function (Model, field, refModel, key) {
                          
                              return function (req, res) {
                                  var gConfig = Model.injector();
                                  var config = utils.getConfigByProfile(gConfig.get, req);
                          Severity: Minor
                          Found in lib/engine/routeinjector/typeBased/typeBased.js - About 55 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

                          Function getQueriedRefField has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          module.exports.getQueriedRefField = function (Model, field, refModel, key) {
                          
                              return function (req, res) {
                                  var gConfig = Model.injector();
                                  var config = utils.getConfigByProfile(gConfig.get, req);
                          Severity: Minor
                          Found in lib/engine/routeinjector/typeBased/typeBased.js - About 55 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

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

                          module.exports.getInvRefField = function (Model, refModel, field) {
                              return function (req, res) {
                                  var gConfig = Model.injector();
                                  var config = utils.getConfigByProfile(gConfig.get, req);
                                  (config.pre) ? utils.runPreCallbacks(config.pre, Model, req, res, mainGetFn) : mainGetFn();
                          Severity: Minor
                          Found in lib/engine/routeinjector/typeBased/typeBased.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

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

                                              if (gConfig.shard && gConfig.shard.shardKey && gConfig.shard.shardKey != "") {
                                                  if (doc[gConfig.shard.shardKey] == undefined) {
                                                      if (req.query[gConfig.shard.shardKey == undefined]) {
                                                          log.error("Shard key not present in query");
                                                          res.statusCode = statusCode.BAD_REQUEST;
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 2 other locations - About 6 hrs to fix
                          lib/engine/routeinjector/rest/put.js on lines 101..111
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 452..463

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

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                              if (gConfig.shard && gConfig.shard.shardKey && gConfig.shard.shardKey != "") {
                                                  if (doc[gConfig.shard.shardKey] == undefined) {
                                                      if (req.query[gConfig.shard.shardKey == undefined]) {
                                                          log.error("Shard key not present in query");
                                                          res.statusCode = statusCode.BAD_REQUEST;
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 2 other locations - About 6 hrs to fix
                          lib/engine/routeinjector/rest/put.js on lines 101..111
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 546..557

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

                          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

                                                  refModel.findOne(newQuery, gConfig.mongo.projection, function (err, results) {
                                                      if (err) {
                                                          res.statusCode = statusCode.INTERNAL_SERVER_ERROR;
                                                          res.json(err);
                                                          return res.end();
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 1 other location - About 6 hrs to fix
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 253..268

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

                          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

                                                          refModel.find(newQuery, gConfig.mongo.projection, function (err, results) {
                                                              if (err) {
                                                                  res.statusCode = statusCode.INTERNAL_SERVER_ERROR;
                                                                  res.json(err);
                                                                  return res.end();
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 1 other location - About 6 hrs to fix
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 68..83

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

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

                                      if (gConfig.shard && gConfig.shard.shardKey && req.query[gConfig.shard.shardKey] != undefined) {
                                          query[gConfig.shard.shardKey] = req.query[gConfig.shard.shardKey];
                                      }
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 4 other locations - About 2 hrs to fix
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 26..28
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 196..198
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 424..426
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 518..520

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

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

                                      if (gConfig.shard && gConfig.shard.shardKey && req.query[gConfig.shard.shardKey] != undefined) {
                                          query[gConfig.shard.shardKey] = req.query[gConfig.shard.shardKey];
                                      }
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 4 other locations - About 2 hrs to fix
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 108..110
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 196..198
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 424..426
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 518..520

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

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

                                          if (gConfig.shard && gConfig.shard.shardKey && req.query[gConfig.shard.shardKey] != undefined) {
                                              query[gConfig.shard.shardKey] = req.query[gConfig.shard.shardKey];
                                          }
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 4 other locations - About 2 hrs to fix
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 26..28
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 108..110
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 196..198
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 424..426

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

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

                                      if (gConfig.shard && gConfig.shard.shardKey && req.query[gConfig.shard.shardKey] != undefined) {
                                          query[gConfig.shard.shardKey] = req.query[gConfig.shard.shardKey];
                                      }
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 4 other locations - About 2 hrs to fix
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 26..28
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 108..110
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 424..426
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 518..520

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

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

                                          if (gConfig.shard && gConfig.shard.shardKey && req.query[gConfig.shard.shardKey] != undefined) {
                                              query[gConfig.shard.shardKey] = req.query[gConfig.shard.shardKey];
                                          }
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 4 other locations - About 2 hrs to fix
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 26..28
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 108..110
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 196..198
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 518..520

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

                          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

                                          function error(err) {
                                              if (res.statsCode == statusCode.OK)
                                                  res.statusCode = statusCode.INTERNAL_SERVER_ERROR;
                          
                                              res.json(err.message);
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 1 other location - About 1 hr to fix
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 481..487

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

                          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

                                          function error(err) {
                                              if (res.statsCode == statusCode.OK)
                                                  res.statusCode = statusCode.INTERNAL_SERVER_ERROR;
                          
                                              res.json(err.message);
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 1 other location - About 1 hr to fix
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 576..582

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

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

                                          if (err) {
                                              log.error(err);
                                              utils.runErrorCallbacks(config, req, err);
                                              res.statusCode = statusCode.INTERNAL_SERVER_ERROR;
                                              res.json(err);
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 4 other locations - About 1 hr to fix
                          lib/engine/routeinjector/rest/search.js on lines 87..235
                          lib/engine/routeinjector/rest/search.js on lines 105..111
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 114..174
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 202..272

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

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

                                          if (err) {
                                              log.error(err);
                                              utils.runErrorCallbacks(config, req, err);
                                              res.statusCode = statusCode.INTERNAL_SERVER_ERROR;
                                              res.json(err);
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 4 other locations - About 1 hr to fix
                          lib/engine/routeinjector/rest/search.js on lines 87..235
                          lib/engine/routeinjector/rest/search.js on lines 105..111
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 32..85
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 114..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 64.

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

                                          if (err) {
                                              log.error(err);
                                              utils.runErrorCallbacks(config, req, err);
                                              res.statusCode = statusCode.INTERNAL_SERVER_ERROR;
                                              res.json(err);
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 4 other locations - About 1 hr to fix
                          lib/engine/routeinjector/rest/search.js on lines 87..235
                          lib/engine/routeinjector/rest/search.js on lines 105..111
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 32..85
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 202..272

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

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

                                      for (var i in config.mongo.query) {
                                          //COPY the object
                                          query[i] = config.mongo.query[i];
                                      }
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 4 other locations - About 40 mins to fix
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 18..21
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 188..191
                          lib/utils/QueryUtils.js on lines 47..50
                          lib/utils/QueryUtils.js on lines 71..74

                          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

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

                                      for (var i in config.mongo.query) {
                                          //COPY the object
                                          query[i] = config.mongo.query[i];
                                      }
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 4 other locations - About 40 mins to fix
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 18..21
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 100..103
                          lib/utils/QueryUtils.js on lines 47..50
                          lib/utils/QueryUtils.js on lines 71..74

                          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

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

                                      for (var i in config.mongo.query) {
                                          //COPY the object
                                          query[i] = config.mongo.query[i];
                                      }
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 4 other locations - About 40 mins to fix
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 100..103
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 188..191
                          lib/utils/QueryUtils.js on lines 47..50
                          lib/utils/QueryUtils.js on lines 71..74

                          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

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

                                          for (var i in config.mongo.query) {
                                              //COPY the object
                                              query[i] = config.mongo.query[i];
                                          }
                          Severity: Minor
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 1 other location - About 35 mins to fix
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 417..420

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

                          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

                                          for (var i in config.mongo.query) {
                                              //COPY the object
                                              query[i] = config.mongo.query[i];
                                          }
                          Severity: Minor
                          Found in lib/engine/routeinjector/typeBased/typeBased.js and 1 other location - About 35 mins to fix
                          lib/engine/routeinjector/typeBased/typeBased.js on lines 511..514

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

                          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

                          There are no issues that match your filters.

                          Category
                          Status