bcgov/common-hosted-email-service

View on GitHub

Showing 117 of 117 total issues

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

  constructor() {
    this.connection = new QueueConnection();
    this.dataService = new DataService();
    this.emailService = new EmailService();
  }
Severity: Minor
Found in app/src/services/queueSvc.js and 1 other location - About 55 mins to fix
app/src/services/chesSvc.js on lines 41..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 54.

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

  constructor() {
    this.dataService = new DataService();
    this.emailService = new EmailService();
    this.queueService = new QueueService();
  }
Severity: Minor
Found in app/src/services/chesSvc.js and 1 other location - About 55 mins to fix
app/src/services/queueSvc.js on lines 63..67

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

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

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

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

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

Refactorings

Further Reading

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

  close(cb = undefined) {
    if (this.queue) {
      try {
        this.queue.whenCurrentJobsFinished().then(() => {
          this.queue.close().then(() => {
Severity: Minor
Found in app/src/services/queueConn.js - About 55 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

  async updateStatus(client, messageId, status, description) {
    let trx;
    try {
      trx = await Message.startTransaction();

Severity: Minor
Found in app/src/services/dataSvc.js - About 55 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

  toStatusResponse: msg => {
    const result = {
      createdTS: msg.createdAt ? moment.utc(msg.createdAt).valueOf() : null,
      delayTS: msg.delayTimestamp ? moment.utc(Number(msg.delayTimestamp)).valueOf() : null,
      msgId: msg.messageId ? msg.messageId : null,
Severity: Minor
Found in app/src/components/transformer.js - About 55 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

  toTransactionResponse: trxn => {
    const result = {
      messages: trxn.messages ? trxn.messages.map(m => {
        return {
          msgId: m.messageId ? m.messageId : null,
Severity: Minor
Found in app/src/components/transformer.js - About 55 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

  close(cb = undefined) {
    if (this.knex) {
      try {
        this.knex.destroy(() => {
          this._connected = false;
Severity: Minor
Found in app/src/services/dataConn.js - About 55 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

  validateEmail: async (req, res, next) => {
    const errors = await validators.email(req.body, config.get('server.attachmentLimit'));
    handleValidationErrors(res, next, errors);
  },
Severity: Minor
Found in app/src/middleware/validation.js and 1 other location - About 50 mins to fix
app/src/middleware/validation.js on lines 32..35

Duplicated Code

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

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

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

Tuning

This issue has a mass of 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 2 locations. Consider refactoring.
Open

  validateMerge: async (req, res, next) => {
    const errors = await validators.merge(req.body, config.get('server.attachmentLimit'));
    handleValidationErrors(res, next, errors);
  },
Severity: Minor
Found in app/src/middleware/validation.js and 1 other location - About 50 mins to fix
app/src/middleware/validation.js on lines 27..30

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

Severity
Category
Status
Source
Language