bcgov/common-hosted-email-service

View on GitHub
app/src/components/validators.js

Summary

Maintainability
F
1 wk
Test Coverage
A
99%

File validators.js has 407 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const bytes = require('bytes');
const fs = require('fs');
const tmp = require('tmp');
const validator = require('validator');

Severity: Minor
Found in app/src/components/validators.js - About 5 hrs to fix

    Function attachments has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      attachments: async (obj, attachmentSizeLimit = DEFAULT_ATTACHMENT_SIZE) => {
        const errors = [];
        if (obj.attachments) {
          if (!Array.isArray(obj.attachments)) {
            errors.push({ value: undefined, message: 'Invalid value `attachments`. Expect an array of attachments.' });
    Severity: Minor
    Found in app/src/components/validators.js - About 1 hr to fix

      Function contexts has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        contexts: obj => {
          const errors = [];
          if (obj.contexts) {
            if (!Array.isArray(obj.contexts)) {
              errors.push({ value: undefined, message: 'Invalid value `contexts`. Expect an array of contexts.' });
      Severity: Minor
      Found in app/src/components/validators.js - About 1 hr to fix

        Function messageFields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          messageFields: (obj, errors) => {
            if (!models.message.from(obj['from'])) {
              errors.push({ value: obj['from'], message: 'Invalid value `from`.' });
            }
            if (!models.message.validSender(obj['from'])) {
        Severity: Minor
        Found in app/src/components/validators.js - About 35 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 email has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          email: async (obj, attachmentSizeLimit = DEFAULT_ATTACHMENT_SIZE) => {
            // validate the email object
            // completely valid object will return an empty array of errors.
            // an invalid object will return a populated array of errors.
            const errors = [];
        Severity: Minor
        Found in app/src/components/validators.js - About 25 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

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

          cancelQuery: query => {
            const errors = [];
        
            if (!query || !Object.keys(query).some(param => validator.isIn(param, ['msgId', 'status', 'tag', 'txId']))) {
              errors.push({
        Severity: Major
        Found in app/src/components/validators.js and 2 other locations - About 4 hrs to fix
        app/src/components/validators.js on lines 432..445
        app/src/components/validators.js on lines 457..470

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

        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

          statusQuery: query => {
            const errors = [];
        
            if (!query || !Object.keys(query).some(param => validator.isIn(param, ['msgId', 'status', 'tag', 'txId']))) {
              errors.push({
        Severity: Major
        Found in app/src/components/validators.js and 2 other locations - About 4 hrs to fix
        app/src/components/validators.js on lines 293..306
        app/src/components/validators.js on lines 432..445

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

        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

          promoteQuery: query => {
            const errors = [];
        
            if (!query || !Object.keys(query).some(param => validator.isIn(param, ['msgId', 'status', 'tag', 'txId']))) {
              errors.push({
        Severity: Major
        Found in app/src/components/validators.js and 2 other locations - About 4 hrs to fix
        app/src/components/validators.js on lines 293..306
        app/src/components/validators.js on lines 457..470

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

        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

          promoteMsg: param => {
            const errors = [];
        
            if (!param.msgId) {
              errors.push({ value: param.msgId, message: 'Missing value `msgId`.' });
        Severity: Major
        Found in app/src/components/validators.js and 1 other location - About 3 hrs to fix
        app/src/components/validators.js on lines 281..291

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

        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

          cancelMsg: param => {
            const errors = [];
        
            if (!param.msgId) {
              errors.push({ value: param.msgId, message: 'Missing value `msgId`.' });
        Severity: Major
        Found in app/src/components/validators.js and 1 other location - About 3 hrs to fix
        app/src/components/validators.js on lines 420..430

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

        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 (!models.attachment.encoding(a['encoding'])) {
                    errors.push({ value: a['encoding'], message: `Attachments[${i}] invalid value \`encoding\`.` });
                    validateSize = false;
                  }
        Severity: Major
        Found in app/src/components/validators.js and 2 other locations - About 1 hr to fix
        app/src/components/validators.js on lines 247..250
        app/src/components/validators.js on lines 255..258

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

        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 (!models.attachment.filename(a['filename'])) {
                    errors.push({ value: a['filename'], message: `Attachments[${i}] invalid value \`filename\`.` });
                    validateSize = false;
                  }
        Severity: Major
        Found in app/src/components/validators.js and 2 other locations - About 1 hr to fix
        app/src/components/validators.js on lines 251..254
        app/src/components/validators.js on lines 255..258

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

        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 (!models.attachment.contentType(a['contentType'])) {
                    errors.push({ value: a['contentType'], message: `Attachments[${i}] invalid value \`contentType\`.` });
                    validateSize = false;
                  }
        Severity: Major
        Found in app/src/components/validators.js and 2 other locations - About 1 hr to fix
        app/src/components/validators.js on lines 247..250
        app/src/components/validators.js on lines 251..254

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

        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 (!models.context.tag(c['tag'])) {
                    errors.push({ value: c['tag'], message: `Contexts[${i}] invalid value \`tag\`.` });
                  }
        Severity: Major
        Found in app/src/components/validators.js and 4 other locations - About 1 hr to fix
        app/src/components/validators.js on lines 315..317
        app/src/components/validators.js on lines 318..320
        app/src/components/validators.js on lines 321..323
        app/src/components/validators.js on lines 327..329

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

        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 (!models.context.to(c['to'])) {
                    errors.push({ value: c['to'], message: `Contexts[${i}] invalid value \`to\`.` });
                  }
        Severity: Major
        Found in app/src/components/validators.js and 4 other locations - About 1 hr to fix
        app/src/components/validators.js on lines 318..320
        app/src/components/validators.js on lines 321..323
        app/src/components/validators.js on lines 324..326
        app/src/components/validators.js on lines 327..329

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

        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 (!models.context.bcc(c['bcc'])) {
                    errors.push({ value: c['bcc'], message: `Contexts[${i}] invalid value \`bcc\`.` });
                  }
        Severity: Major
        Found in app/src/components/validators.js and 4 other locations - About 1 hr to fix
        app/src/components/validators.js on lines 315..317
        app/src/components/validators.js on lines 318..320
        app/src/components/validators.js on lines 324..326
        app/src/components/validators.js on lines 327..329

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

        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 (!models.context.cc(c['cc'])) {
                    errors.push({ value: c['cc'], message: `Contexts[${i}] invalid value \`cc\`.` });
                  }
        Severity: Major
        Found in app/src/components/validators.js and 4 other locations - About 1 hr to fix
        app/src/components/validators.js on lines 315..317
        app/src/components/validators.js on lines 321..323
        app/src/components/validators.js on lines 324..326
        app/src/components/validators.js on lines 327..329

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

        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 (!models.context.delayTS(c['delayTS'])) {
                    errors.push({ value: c['delayTS'], message: `Contexts[${i}] invalid value \`delayTS\`.` });
                  }
        Severity: Major
        Found in app/src/components/validators.js and 4 other locations - About 1 hr to fix
        app/src/components/validators.js on lines 315..317
        app/src/components/validators.js on lines 318..320
        app/src/components/validators.js on lines 321..323
        app/src/components/validators.js on lines 324..326

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

        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

            tag: value => {
              if (value) {
                return validatorUtils.isString(value) && !validator.isEmpty(value, { ignore_whitespace: true });
              }
              return true;
        Severity: Major
        Found in app/src/components/validators.js and 2 other locations - About 1 hr to fix
        app/src/components/validators.js on lines 26..31
        app/src/components/validators.js on lines 220..225

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

        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

            tag: value => {
              if (value) {
                return validatorUtils.isString(value) && !validator.isEmpty(value, { ignore_whitespace: true });
              }
              return true;
        Severity: Major
        Found in app/src/components/validators.js and 2 other locations - About 1 hr to fix
        app/src/components/validators.js on lines 26..31
        app/src/components/validators.js on lines 183..188

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

        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

            contentType: value => {
              if (value) {
                return validatorUtils.isString(value) && !validator.isEmpty(value, { ignore_whitespace: true });
              }
              return true;
        Severity: Major
        Found in app/src/components/validators.js and 2 other locations - About 1 hr to fix
        app/src/components/validators.js on lines 183..188
        app/src/components/validators.js on lines 220..225

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

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

            if (!models.message.subject(obj['subject'])) {
              errors.push({ value: obj['subject'], message: 'Invalid value `subject`.' });
            }
        Severity: Major
        Found in app/src/components/validators.js and 9 other locations - About 50 mins to fix
        app/src/components/validators.js on lines 356..358
        app/src/components/validators.js on lines 359..361
        app/src/components/validators.js on lines 362..364
        app/src/components/validators.js on lines 365..367
        app/src/components/validators.js on lines 368..370
        app/src/components/validators.js on lines 380..382
        app/src/components/validators.js on lines 389..391
        app/src/components/validators.js on lines 395..397
        app/src/components/validators.js on lines 398..400

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 51.

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

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

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

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

        Refactorings

        Further Reading

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

            if (!models.message.from(obj['from'])) {
              errors.push({ value: obj['from'], message: 'Invalid value `from`.' });
            }
        Severity: Major
        Found in app/src/components/validators.js and 9 other locations - About 50 mins to fix
        app/src/components/validators.js on lines 356..358
        app/src/components/validators.js on lines 359..361
        app/src/components/validators.js on lines 362..364
        app/src/components/validators.js on lines 365..367
        app/src/components/validators.js on lines 368..370
        app/src/components/validators.js on lines 386..388
        app/src/components/validators.js on lines 389..391
        app/src/components/validators.js on lines 395..397
        app/src/components/validators.js on lines 398..400

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 51.

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

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

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

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

        Refactorings

        Further Reading

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

            if (!models.message.to(obj['to'])) {
              errors.push({ value: obj['to'], message: 'Invalid value `to`.' });
            }
        Severity: Major
        Found in app/src/components/validators.js and 9 other locations - About 50 mins to fix
        app/src/components/validators.js on lines 359..361
        app/src/components/validators.js on lines 362..364
        app/src/components/validators.js on lines 365..367
        app/src/components/validators.js on lines 368..370
        app/src/components/validators.js on lines 380..382
        app/src/components/validators.js on lines 386..388
        app/src/components/validators.js on lines 389..391
        app/src/components/validators.js on lines 395..397
        app/src/components/validators.js on lines 398..400

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 51.

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

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

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

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

        Refactorings

        Further Reading

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

            if (!models.message.cc(obj['cc'])) {
              errors.push({ value: obj['cc'], message: 'Invalid value `cc`.' });
            }
        Severity: Major
        Found in app/src/components/validators.js and 9 other locations - About 50 mins to fix
        app/src/components/validators.js on lines 356..358
        app/src/components/validators.js on lines 362..364
        app/src/components/validators.js on lines 365..367
        app/src/components/validators.js on lines 368..370
        app/src/components/validators.js on lines 380..382
        app/src/components/validators.js on lines 386..388
        app/src/components/validators.js on lines 389..391
        app/src/components/validators.js on lines 395..397
        app/src/components/validators.js on lines 398..400

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 51.

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

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

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

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

        Refactorings

        Further Reading

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

            if (!models.message.bcc(obj['bcc'])) {
              errors.push({ value: obj['bcc'], message: 'Invalid value `bcc`.' });
            }
        Severity: Major
        Found in app/src/components/validators.js and 9 other locations - About 50 mins to fix
        app/src/components/validators.js on lines 356..358
        app/src/components/validators.js on lines 359..361
        app/src/components/validators.js on lines 365..367
        app/src/components/validators.js on lines 368..370
        app/src/components/validators.js on lines 380..382
        app/src/components/validators.js on lines 386..388
        app/src/components/validators.js on lines 389..391
        app/src/components/validators.js on lines 395..397
        app/src/components/validators.js on lines 398..400

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 51.

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

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

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

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

        Refactorings

        Further Reading

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

            if (!models.message.bodyType(obj['bodyType'])) {
              errors.push({ value: obj['bodyType'], message: 'Invalid value `bodyType`.' });
            }
        Severity: Major
        Found in app/src/components/validators.js and 9 other locations - About 50 mins to fix
        app/src/components/validators.js on lines 356..358
        app/src/components/validators.js on lines 359..361
        app/src/components/validators.js on lines 362..364
        app/src/components/validators.js on lines 365..367
        app/src/components/validators.js on lines 368..370
        app/src/components/validators.js on lines 380..382
        app/src/components/validators.js on lines 386..388
        app/src/components/validators.js on lines 395..397
        app/src/components/validators.js on lines 398..400

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 51.

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

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

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

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

        Refactorings

        Further Reading

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

            if (!models.message.encoding(obj['encoding'])) {
              errors.push({ value: obj['encoding'], message: 'Invalid value `encoding`.' });
            }
        Severity: Major
        Found in app/src/components/validators.js and 9 other locations - About 50 mins to fix
        app/src/components/validators.js on lines 356..358
        app/src/components/validators.js on lines 359..361
        app/src/components/validators.js on lines 362..364
        app/src/components/validators.js on lines 365..367
        app/src/components/validators.js on lines 368..370
        app/src/components/validators.js on lines 380..382
        app/src/components/validators.js on lines 386..388
        app/src/components/validators.js on lines 389..391
        app/src/components/validators.js on lines 398..400

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 51.

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

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

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

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

        Refactorings

        Further Reading

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

            if (!models.message.delayTS(obj['delayTS'])) {
              errors.push({ value: obj['delayTS'], message: 'Invalid value `delayTS`.' });
            }
        Severity: Major
        Found in app/src/components/validators.js and 9 other locations - About 50 mins to fix
        app/src/components/validators.js on lines 356..358
        app/src/components/validators.js on lines 359..361
        app/src/components/validators.js on lines 362..364
        app/src/components/validators.js on lines 365..367
        app/src/components/validators.js on lines 380..382
        app/src/components/validators.js on lines 386..388
        app/src/components/validators.js on lines 389..391
        app/src/components/validators.js on lines 395..397
        app/src/components/validators.js on lines 398..400

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 51.

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

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

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

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

        Refactorings

        Further Reading

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

            if (!models.message.priority(obj['priority'])) {
              errors.push({ value: obj['priority'], message: 'Invalid value `priority`.' });
            }
        Severity: Major
        Found in app/src/components/validators.js and 9 other locations - About 50 mins to fix
        app/src/components/validators.js on lines 356..358
        app/src/components/validators.js on lines 359..361
        app/src/components/validators.js on lines 362..364
        app/src/components/validators.js on lines 365..367
        app/src/components/validators.js on lines 368..370
        app/src/components/validators.js on lines 380..382
        app/src/components/validators.js on lines 386..388
        app/src/components/validators.js on lines 389..391
        app/src/components/validators.js on lines 395..397

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 51.

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

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

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

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

        Refactorings

        Further Reading

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

            if (!models.message.tag(obj['tag'])) {
              errors.push({ value: obj['tag'], message: 'Invalid value `tag`.' });
            }
        Severity: Major
        Found in app/src/components/validators.js and 9 other locations - About 50 mins to fix
        app/src/components/validators.js on lines 356..358
        app/src/components/validators.js on lines 359..361
        app/src/components/validators.js on lines 362..364
        app/src/components/validators.js on lines 368..370
        app/src/components/validators.js on lines 380..382
        app/src/components/validators.js on lines 386..388
        app/src/components/validators.js on lines 389..391
        app/src/components/validators.js on lines 395..397
        app/src/components/validators.js on lines 398..400

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 51.

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

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

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

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

        Refactorings

        Further Reading

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

            msgId: value => {
              if (value) {
                return validatorUtils.isString(value) && validator.isUUID(value);
              }
              return true;
        Severity: Minor
        Found in app/src/components/validators.js and 1 other location - About 35 mins to fix
        app/src/components/validators.js on lines 228..233

        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

            txId: value => {
              if (value) {
                return validatorUtils.isString(value) && validator.isUUID(value);
              }
              return true;
        Severity: Minor
        Found in app/src/components/validators.js and 1 other location - About 35 mins to fix
        app/src/components/validators.js on lines 204..209

        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

            body: value => {
              return validatorUtils.isString(value) && !validator.isEmpty(value, { ignore_whitespace: true });
            },
        Severity: Major
        Found in app/src/components/validators.js and 3 other locations - About 30 mins to fix
        app/src/components/validators.js on lines 21..23
        app/src/components/validators.js on lines 42..44
        app/src/components/validators.js on lines 178..180

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

        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

            filename: value => {
              return validatorUtils.isString(value) && !validator.isEmpty(value, { ignore_whitespace: true });
            },
        Severity: Major
        Found in app/src/components/validators.js and 3 other locations - About 30 mins to fix
        app/src/components/validators.js on lines 21..23
        app/src/components/validators.js on lines 131..133
        app/src/components/validators.js on lines 178..180

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

        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

            content: value => {
              return validatorUtils.isString(value) && !validator.isEmpty(value, { ignore_whitespace: true });
            },
        Severity: Major
        Found in app/src/components/validators.js and 3 other locations - About 30 mins to fix
        app/src/components/validators.js on lines 42..44
        app/src/components/validators.js on lines 131..133
        app/src/components/validators.js on lines 178..180

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

        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

            subject: value => {
              return validatorUtils.isString(value) && !validator.isEmpty(value, { ignore_whitespace: true });
            },
        Severity: Major
        Found in app/src/components/validators.js and 3 other locations - About 30 mins to fix
        app/src/components/validators.js on lines 21..23
        app/src/components/validators.js on lines 42..44
        app/src/components/validators.js on lines 131..133

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

        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