TryGhost/Ghost

View on GitHub
ghost/core/core/server/services/route-settings/validate.js

Summary

Maintainability
F
4 days
Test Coverage

Function validateData has 118 lines of code (exceeds 25 allowed). Consider refactoring.
Open

_private.validateData = function validateData(object) {
    if (!Object.prototype.hasOwnProperty.call(object, 'data')) {
        return object;
    }

Severity: Major
Found in ghost/core/core/server/services/route-settings/validate.js - About 4 hrs to fix

    File validate.js has 345 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const _ = require('lodash');
    const tpl = require('@tryghost/tpl');
    const errors = require('@tryghost/errors');
    const _private = {};
    let RESOURCE_CONFIG;
    Severity: Minor
    Found in ghost/core/core/server/services/route-settings/validate.js - About 4 hrs to fix

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

      _private.validateCollections = function validateCollections(collections) {
          if (collections.constructor !== Object) {
              throw new errors.ValidationError({
                  message: tpl(messages.validationError, {
                      at: collections,
      Severity: Major
      Found in ghost/core/core/server/services/route-settings/validate.js - About 2 hrs to fix

        Function validateTaxonomies has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        _private.validateTaxonomies = function validateTaxonomies(taxonomies) {
            if (taxonomies.constructor !== Object) {
                throw new errors.ValidationError({
                    message: tpl(messages.validationError, {
                        at: taxonomies,
        Severity: Major
        Found in ghost/core/core/server/services/route-settings/validate.js - About 2 hrs to fix

          Function validateRoutes has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          _private.validateRoutes = function validateRoutes(routes) {
              if (routes.constructor !== Object) {
                  throw new errors.ValidationError({
                      message: tpl(messages.validationError, {
                          at: routes,
          Severity: Minor
          Found in ghost/core/core/server/services/route-settings/validate.js - About 1 hr to fix

            Function shortToLongForm has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                const shortToLongForm = (shortForm, options = {}) => {
                    let longForm = {
                        query: {},
                        router: {}
                    };
            Severity: Minor
            Found in ghost/core/core/server/services/route-settings/validate.js - About 1 hr to fix

              Function validateData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              _private.validateData = function validateData(object) {
                  if (!Object.prototype.hasOwnProperty.call(object, 'data')) {
                      return object;
                  }
              
              
              Severity: Minor
              Found in ghost/core/core/server/services/route-settings/validate.js - About 1 hr to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                      if (!routingTypeObject.permalink.match(/\/$/)) {
                          throw new errors.ValidationError({
                              message: tpl(messages.validationError, {
                                  at: routingTypeObject.permalink,
                                  reason: 'A trailing slash is required.'
              Severity: Major
              Found in ghost/core/core/server/services/route-settings/validate.js and 1 other location - About 1 hr to fix
              ghost/core/core/server/services/route-settings/validate.js on lines 306..313

              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

                      if (!routingTypeObject.permalink.match(/^\//)) {
                          throw new errors.ValidationError({
                              message: tpl(messages.validationError, {
                                  at: routingTypeObject.permalink,
                                  reason: 'A leading slash is required.'
              Severity: Major
              Found in ghost/core/core/server/services/route-settings/validate.js and 1 other location - About 1 hr to fix
              ghost/core/core/server/services/route-settings/validate.js on lines 296..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 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 5 locations. Consider refactoring.
              Open

                      if (!routingTypeObject.match(/^\//)) {
                          throw new errors.ValidationError({
                              message: tpl(messages.validationError, {
                                  at: routingTypeObject,
                                  reason: 'A leading slash is required.'
              Severity: Major
              Found in ghost/core/core/server/services/route-settings/validate.js and 4 other locations - About 1 hr to fix
              ghost/core/core/server/services/route-settings/validate.js on lines 205..212
              ghost/core/core/server/services/route-settings/validate.js on lines 215..222
              ghost/core/core/server/services/route-settings/validate.js on lines 254..261
              ghost/core/core/server/services/route-settings/validate.js on lines 370..377

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

              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 (!routingTypeObjectKey.match(/\/$/)) {
                          throw new errors.ValidationError({
                              message: tpl(messages.validationError, {
                                  at: routingTypeObjectKey,
                                  reason: 'A trailing slash is required.'
              Severity: Major
              Found in ghost/core/core/server/services/route-settings/validate.js and 4 other locations - About 1 hr to fix
              ghost/core/core/server/services/route-settings/validate.js on lines 215..222
              ghost/core/core/server/services/route-settings/validate.js on lines 254..261
              ghost/core/core/server/services/route-settings/validate.js on lines 370..377
              ghost/core/core/server/services/route-settings/validate.js on lines 380..387

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

              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 (!routingTypeObjectKey.match(/\/$/)) {
                          throw new errors.ValidationError({
                              message: tpl(messages.validationError, {
                                  at: routingTypeObjectKey,
                                  reason: 'A trailing slash is required.'
              Severity: Major
              Found in ghost/core/core/server/services/route-settings/validate.js and 4 other locations - About 1 hr to fix
              ghost/core/core/server/services/route-settings/validate.js on lines 205..212
              ghost/core/core/server/services/route-settings/validate.js on lines 215..222
              ghost/core/core/server/services/route-settings/validate.js on lines 370..377
              ghost/core/core/server/services/route-settings/validate.js on lines 380..387

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

              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 (!routingTypeObject.match(/\/$/)) {
                          throw new errors.ValidationError({
                              message: tpl(messages.validationError, {
                                  at: routingTypeObject,
                                  reason: 'A trailing slash is required.'
              Severity: Major
              Found in ghost/core/core/server/services/route-settings/validate.js and 4 other locations - About 1 hr to fix
              ghost/core/core/server/services/route-settings/validate.js on lines 205..212
              ghost/core/core/server/services/route-settings/validate.js on lines 215..222
              ghost/core/core/server/services/route-settings/validate.js on lines 254..261
              ghost/core/core/server/services/route-settings/validate.js on lines 380..387

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

              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 (!routingTypeObjectKey.match(/^\//)) {
                          throw new errors.ValidationError({
                              message: tpl(messages.validationError, {
                                  at: routingTypeObjectKey,
                                  reason: 'A leading slash is required.'
              Severity: Major
              Found in ghost/core/core/server/services/route-settings/validate.js and 4 other locations - About 1 hr to fix
              ghost/core/core/server/services/route-settings/validate.js on lines 205..212
              ghost/core/core/server/services/route-settings/validate.js on lines 254..261
              ghost/core/core/server/services/route-settings/validate.js on lines 370..377
              ghost/core/core/server/services/route-settings/validate.js on lines 380..387

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

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

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

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

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

              Refactorings

              Further Reading

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

                  if (routes.constructor !== Object) {
                      throw new errors.ValidationError({
                          message: tpl(messages.validationError, {
                              at: routes,
                              reason: '`routes` must be a YAML map.'
              Severity: Major
              Found in ghost/core/core/server/services/route-settings/validate.js and 2 other locations - About 50 mins to fix
              ghost/core/core/server/services/route-settings/validate.js on lines 243..250
              ghost/core/core/server/services/route-settings/validate.js on lines 339..346

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 52.

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

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

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

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

              Refactorings

              Further Reading

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

                  if (taxonomies.constructor !== Object) {
                      throw new errors.ValidationError({
                          message: tpl(messages.validationError, {
                              at: taxonomies,
                              reason: '`taxonomies` must be a YAML map.'
              Severity: Major
              Found in ghost/core/core/server/services/route-settings/validate.js and 2 other locations - About 50 mins to fix
              ghost/core/core/server/services/route-settings/validate.js on lines 194..201
              ghost/core/core/server/services/route-settings/validate.js on lines 243..250

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 52.

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

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

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

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

              Refactorings

              Further Reading

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

                  if (collections.constructor !== Object) {
                      throw new errors.ValidationError({
                          message: tpl(messages.validationError, {
                              at: collections,
                              reason: '`collections` must be a YAML map.'
              Severity: Major
              Found in ghost/core/core/server/services/route-settings/validate.js and 2 other locations - About 50 mins to fix
              ghost/core/core/server/services/route-settings/validate.js on lines 194..201
              ghost/core/core/server/services/route-settings/validate.js on lines 339..346

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 52.

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

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

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

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

              Refactorings

              Further Reading

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

                      if (!routingTypeObject.permalink) {
                          throw new errors.ValidationError({
                              message: tpl(messages.validationError, {
                                  at: routingTypeObjectKey,
                                  reason: 'Please define a permalink route.'
              Severity: Major
              Found in ghost/core/core/server/services/route-settings/validate.js and 3 other locations - About 35 mins to fix
              ghost/core/core/server/services/route-settings/validate.js on lines 225..233
              ghost/core/core/server/services/route-settings/validate.js on lines 273..281
              ghost/core/core/server/services/route-settings/validate.js on lines 350..358

              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

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

                      if (!routingTypeObject) {
                          throw new errors.ValidationError({
                              message: tpl(messages.validationError, {
                                  at: routingTypeObjectKey,
                                  reason: 'Please define a taxonomy permalink route.'
              Severity: Major
              Found in ghost/core/core/server/services/route-settings/validate.js and 3 other locations - About 35 mins to fix
              ghost/core/core/server/services/route-settings/validate.js on lines 225..233
              ghost/core/core/server/services/route-settings/validate.js on lines 273..281
              ghost/core/core/server/services/route-settings/validate.js on lines 285..293

              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

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

                      if (!routingTypeObject) {
                          throw new errors.ValidationError({
                              message: tpl(messages.validationError, {
                                  at: routingTypeObjectKey,
                                  reason: 'Please define a template.'
              Severity: Major
              Found in ghost/core/core/server/services/route-settings/validate.js and 3 other locations - About 35 mins to fix
              ghost/core/core/server/services/route-settings/validate.js on lines 273..281
              ghost/core/core/server/services/route-settings/validate.js on lines 285..293
              ghost/core/core/server/services/route-settings/validate.js on lines 350..358

              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

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

                      if (!Object.prototype.hasOwnProperty.call(routingTypeObject, 'permalink')) {
                          throw new errors.ValidationError({
                              message: tpl(messages.validationError, {
                                  at: routingTypeObjectKey,
                                  reason: 'Please define a permalink route.'
              Severity: Major
              Found in ghost/core/core/server/services/route-settings/validate.js and 3 other locations - About 35 mins to fix
              ghost/core/core/server/services/route-settings/validate.js on lines 225..233
              ghost/core/core/server/services/route-settings/validate.js on lines 285..293
              ghost/core/core/server/services/route-settings/validate.js on lines 350..358

              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

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

                          (Object.prototype.hasOwnProperty.call(RESOURCE_CONFIG.QUERY[resourceKey], 'internal') && RESOURCE_CONFIG.QUERY[resourceKey].internal === true)) {
              Severity: Minor
              Found in ghost/core/core/server/services/route-settings/validate.js and 1 other location - About 35 mins to fix
              ghost/core/core/server/data/schema/validator.js on lines 44..45

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 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