RouteInjector/route-injector

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

Summary

Maintainability
F
1 wk
Test Coverage

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

function transform(Model, key, fullKey, modelConfig, field) {
    /*var sc = getElementSchema(Model.schema.paths, fullKey);
     if(sc){
     sc.options["x-schema-form"] = sc.options["x-schema-form"] || {};
     sc.options["x-schema-form"]["disableSuccessState"] = true;
Severity: Minor
Found in lib/engine/routeinjector/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 walkSchema has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

function walkSchema(app, Model, schema, parentName, fromArray, rawPath) {
    var modelConfig = utils.getModels()[Model.modelName];
    for (var key in schema) {
        var field = schema[key];
Severity: Minor
Found in lib/engine/routeinjector/typeBased.js - About 3 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 transform has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function transform(Model, key, fullKey, modelConfig, field) {
    /*var sc = getElementSchema(Model.schema.paths, fullKey);
     if(sc){
     sc.options["x-schema-form"] = sc.options["x-schema-form"] || {};
     sc.options["x-schema-form"]["disableSuccessState"] = true;
Severity: Major
Found in lib/engine/routeinjector/typeBased.js - About 3 hrs to fix

    Function walkSchema has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function walkSchema(app, Model, schema, parentName, fromArray, rawPath) {
        var modelConfig = utils.getModels()[Model.modelName];
        for (var key in schema) {
            var field = schema[key];
    
    Severity: Minor
    Found in lib/engine/routeinjector/typeBased.js - About 1 hr to fix

      Function walkSchema has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function walkSchema(app, Model, schema, parentName, fromArray, rawPath) {
      Severity: Minor
      Found in lib/engine/routeinjector/typeBased.js - About 45 mins to fix

        Function injectRefs has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function injectRefs(app, baseConfig, refConfig, Model, refModel, key) {
        Severity: Minor
        Found in lib/engine/routeinjector/typeBased.js - About 45 mins to fix

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

          function injectArrays(app, field, key, Model, baseConfig, rawPath) {
              log.debug("Inject array methods for model " + Model.modelName + " and field " + key);
              //app.get(gConfig.apiBasePath + '/' + baseConfig.path + '/:' + baseConfig.id + '/' + key, refs.getAllArray(Model, key));
              //app.get(gConfig.apiBasePath + '/' + baseConfig.path + '/:' + baseConfig.id + '/' + key + '/:index', refs.getArrayElementAt(Model, key));
          
          Severity: Minor
          Found in lib/engine/routeinjector/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

          Function injectArrays has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function injectArrays(app, field, key, Model, baseConfig, rawPath) {
          Severity: Minor
          Found in lib/engine/routeinjector/typeBased.js - About 45 mins to fix

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

            function transform(Model, key, fullKey, modelConfig, field) {
            Severity: Minor
            Found in lib/engine/routeinjector/typeBased.js - About 35 mins to fix

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

                  if (field.feedback != undefined) {
                      var sc = getElementSchema(Model.schema.paths, fullKey);
                      if (sc) {
                          sc.options["x-schema-form"] = sc.options["x-schema-form"] || {};
                          sc.options["x-schema-form"]["feedback"] = field.feedback;
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 1 other location - About 2 hrs to fix
              lib/engine/routeinjector/typeBased.js on lines 141..147

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

              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 (field.validationMessage != undefined) {
                      var sc = getElementSchema(Model.schema.paths, fullKey);
                      if (sc) {
                          sc.options["x-schema-form"] = sc.options["x-schema-form"] || {};
                          sc.options["x-schema-form"]["feedback"] = field.feedback;
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 1 other location - About 2 hrs to fix
              lib/engine/routeinjector/typeBased.js on lines 133..139

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

              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 (field.class) {
                      var sc = getElementSchema(Model.schema.paths, fullKey);
                      if (sc) {
                          sc.options["x-schema-form"] = sc.options["x-schema-form"] || {};
                          sc.options["x-schema-form"]["htmlClass"] = field.class;
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 4 other locations - About 2 hrs to fix
              lib/engine/routeinjector/typeBased.js on lines 101..107
              lib/engine/routeinjector/typeBased.js on lines 109..115
              lib/engine/routeinjector/typeBased.js on lines 117..123
              lib/engine/routeinjector/typeBased.js on lines 125..131

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

              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 (field.fieldClass) {
                      var sc = getElementSchema(Model.schema.paths, fullKey);
                      if (sc) {
                          sc.options["x-schema-form"] = sc.options["x-schema-form"] || {};
                          sc.options["x-schema-form"]["fieldHtmlClass"] = field.fieldClass;
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 4 other locations - About 2 hrs to fix
              lib/engine/routeinjector/typeBased.js on lines 93..99
              lib/engine/routeinjector/typeBased.js on lines 109..115
              lib/engine/routeinjector/typeBased.js on lines 117..123
              lib/engine/routeinjector/typeBased.js on lines 125..131

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

              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 (field.placeholder) {
                      var sc = getElementSchema(Model.schema.paths, fullKey);
                      if (sc) {
                          sc.options["x-schema-form"] = sc.options["x-schema-form"] || {};
                          sc.options["x-schema-form"]["placeholder"] = field.placeholder;
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 4 other locations - About 2 hrs to fix
              lib/engine/routeinjector/typeBased.js on lines 93..99
              lib/engine/routeinjector/typeBased.js on lines 101..107
              lib/engine/routeinjector/typeBased.js on lines 109..115
              lib/engine/routeinjector/typeBased.js on lines 125..131

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

              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 (field.labelClass) {
                      var sc = getElementSchema(Model.schema.paths, fullKey);
                      if (sc) {
                          sc.options["x-schema-form"] = sc.options["x-schema-form"] || {};
                          sc.options["x-schema-form"]["labelHtmlClass"] = field.labelClass;
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 4 other locations - About 2 hrs to fix
              lib/engine/routeinjector/typeBased.js on lines 93..99
              lib/engine/routeinjector/typeBased.js on lines 101..107
              lib/engine/routeinjector/typeBased.js on lines 117..123
              lib/engine/routeinjector/typeBased.js on lines 125..131

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

              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 (field.notitle) {
                      var sc = getElementSchema(Model.schema.paths, fullKey);
                      if (sc) {
                          sc.options["x-schema-form"] = sc.options["x-schema-form"] || {};
                          sc.options["x-schema-form"]["notitle"] = field.notitle;
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 4 other locations - About 2 hrs to fix
              lib/engine/routeinjector/typeBased.js on lines 93..99
              lib/engine/routeinjector/typeBased.js on lines 101..107
              lib/engine/routeinjector/typeBased.js on lines 109..115
              lib/engine/routeinjector/typeBased.js on lines 117..123

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

              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 (!field.dependsOn.params) {
                          var sc = getElementSchema(Model.schema.paths, fullKey);
                          if (sc) {
                              var params = [];
                              params.push(sc.options.dependsOn.field);
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 1 other location - About 2 hrs to fix
              lib/engine/routeinjector/typeBased.js on lines 165..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 81.

              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

                      } else if (!(field.dependsOn.params instanceof Array)) {
                          var sc = getElementSchema(Model.schema.paths, fullKey);
                          if (sc) {
                              var params = [];
                              params.push(sc.options.dependsOn.params);
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 1 other location - About 2 hrs to fix
              lib/engine/routeinjector/typeBased.js on lines 158..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 81.

              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

                  app.get(injector.config.routes.prefix + '/' + baseConfig.plural + '/' + key + '/:' + refConfig.id,
                      baseConfig.search.middleware || [],
                      typeBased.indirectReferenceGet(Model, refModel, key)
                  );
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 1 other location - About 2 hrs to fix
              lib/engine/routeinjector/typeBased.js on lines 244..247

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

              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

                  app.post(injector.config.routes.prefix + '/' + baseConfig.plural + '/' + key + '/:' + refConfig.id,
                      baseConfig.search.middleware || [],
                      typeBased.indirectReferencePost(Model, refModel, key)
                  );
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 1 other location - About 2 hrs to fix
              lib/engine/routeinjector/typeBased.js on lines 238..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 79.

              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

                      app.post(injector.config.routes.prefix + '/' + baseConfig.path + '/:' + baseConfig.id + '/' + key + '/:index', refs.postArrayElementAt(Model, key));
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 1 other location - About 1 hr to fix
              lib/engine/routeinjector/typeBased.js on lines 304..304

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

              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

                      app.post(injector.config.routes.prefix + '/' + baseConfig.path + '/:' + baseConfig.id + '/' + key + '/:index', refs.postArrayElementAt(Model, key));
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 1 other location - About 1 hr to fix
              lib/engine/routeinjector/typeBased.js on lines 297..297

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

              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

                      } else if (field.type == "object" && field.properties && field.properties.image && field.properties.image.format && field.properties.image.format == 'image') {
                          injectImages(app, Model, fullKey);
                      } else if (field.type == "object" && field.properties && field.properties.file && field.properties.file.format && field.properties.file.format == 'file') {
                          injectFiles(app, Model, fullKey);
                      } else if (field.type == "array") {
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 1 other location - About 1 hr to fix
              lib/engine/routeinjector/typeBased.js on lines 213..219

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

              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

                      } else if (field.type == "object" && field.properties && field.properties.file && field.properties.file.format && field.properties.file.format == 'file') {
                          injectFiles(app, Model, fullKey);
                      } else if (field.type == "array") {
                          injectArrays(app, field, fullKey, Model, modelConfig, absolutePath);
                      } else if (field.type == "object") {
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 1 other location - About 1 hr to fix
              lib/engine/routeinjector/typeBased.js on lines 211..219

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

              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

                      app.post(injector.config.routes.prefix + '/' + baseConfig.path + '/:' + baseConfig.id + '/' + key, refs.appendArrayElement(Model, key));
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 1 other location - About 1 hr to fix
              lib/engine/routeinjector/typeBased.js on lines 303..303

              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

                      app.post(injector.config.routes.prefix + '/' + baseConfig.path + '/:' + baseConfig.id + '/' + key, refs.appendArrayElement(Model, key));
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 1 other location - About 1 hr to fix
              lib/engine/routeinjector/typeBased.js on lines 296..296

              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

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

                  log.debug("[POST] Injecting indirected reference. " + injector.config.routes.prefix + '/' + baseConfig.plural + '/' + key + '/:' + refConfig.id)
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 1 other location - About 1 hr to fix
              lib/engine/routeinjector/typeBased.js on lines 237..237

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

              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

                  log.debug("[GET] Injecting indirected reference. " + injector.config.routes.prefix + '/' + baseConfig.plural + '/' + key + '/:' + refConfig.id)
              Severity: Major
              Found in lib/engine/routeinjector/typeBased.js and 1 other location - About 1 hr to fix
              lib/engine/routeinjector/typeBased.js on lines 243..243

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

              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