integrations/src/__tests__/nylas.test.ts

Summary

Maintainability
F
5 days
Test Coverage

File nylas.test.ts has 951 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as Nylas from 'nylas';
import * as sinon from 'sinon';
import {
  configFactory,
  integrationFactory,
Severity: Major
Found in integrations/src/__tests__/nylas.test.ts - About 2 days to fix

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

      test('Get messages', async () => {
        const mock = sinon.stub(api, 'nylasRequest').callsFake(() => {
          return Promise.resolve({
            from: [{ name: 'test', email: 'user@mail.com' }]
          });
    Severity: Major
    Found in integrations/src/__tests__/nylas.test.ts and 1 other location - About 5 hrs to fix
    integrations/src/__tests__/nylas.test.ts on lines 1014..1027

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

    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

      test('Get message by id', async () => {
        const mock = sinon.stub(api, 'nylasRequest').callsFake(() => {
          return Promise.resolve({
            from: [{ name: 'test', email: 'user@mail.com' }]
          });
    Severity: Major
    Found in integrations/src/__tests__/nylas.test.ts and 1 other location - About 5 hrs to fix
    integrations/src/__tests__/nylas.test.ts on lines 1029..1042

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

    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

        try {
          await auth.connectProviderToNylas({
            uid: 'uid',
            integrationId: 'erxesApiIdDuplicated'
          });
    Severity: Major
    Found in integrations/src/__tests__/nylas.test.ts and 2 other locations - About 1 hr to fix
    api/src/__tests__/fieldDb.test.ts on lines 95..99
    integrations/src/__tests__/nylas.test.ts on lines 765..772

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

    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

        try {
          await auth.connectProviderToNylas({
            uid: 'alksdjalkdj',
            integrationId: 'erxesApiId'
          });
    Severity: Major
    Found in integrations/src/__tests__/nylas.test.ts and 2 other locations - About 1 hr to fix
    api/src/__tests__/fieldDb.test.ts on lines 95..99
    integrations/src/__tests__/nylas.test.ts on lines 724..731

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

    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

        messageMock.onCall(2).callsFake(() => {
          return Promise.resolve({
            from: [{ email: 'john@mail.com' }],
            subject: 'Re: subject'
          });
    Severity: Minor
    Found in integrations/src/__tests__/nylas.test.ts and 1 other location - About 55 mins to fix
    integrations/src/__tests__/nylas.test.ts on lines 1101..1110

    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

        messageMock.onCall(0).callsFake(() => {
          return Promise.resolve({
            from: [
              {
                email: 'email'
    Severity: Minor
    Found in integrations/src/__tests__/nylas.test.ts and 1 other location - About 55 mins to fix
    integrations/src/__tests__/nylas.test.ts on lines 1122..1127

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

        const nylasConfigMock = sinon
          .stub(nylasUtils, 'getNylasConfig')
          .callsFake(() => {
            return Promise.resolve({
              NYLAS_CLIENT_ID: 'NYLAS_CLIENT_ID',
    Severity: Major
    Found in integrations/src/__tests__/nylas.test.ts and 5 other locations - About 50 mins to fix
    integrations/src/__tests__/nylas.test.ts on lines 132..139
    integrations/src/__tests__/nylas.test.ts on lines 190..197
    integrations/src/__tests__/nylas.test.ts on lines 295..302
    integrations/src/__tests__/nylasController.test.ts on lines 224..231
    integrations/src/__tests__/nylasController.test.ts on lines 419..426

    Duplicated Code

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

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

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

    Tuning

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

        const nylasConfigMock = sinon
          .stub(nylasUtils, 'getNylasConfig')
          .callsFake(() => {
            return Promise.resolve({
              NYLAS_CLIENT_ID: 'NYLAS_CLIENT_ID',
    Severity: Major
    Found in integrations/src/__tests__/nylas.test.ts and 5 other locations - About 50 mins to fix
    integrations/src/__tests__/nylas.test.ts on lines 190..197
    integrations/src/__tests__/nylas.test.ts on lines 239..246
    integrations/src/__tests__/nylas.test.ts on lines 295..302
    integrations/src/__tests__/nylasController.test.ts on lines 224..231
    integrations/src/__tests__/nylasController.test.ts on lines 419..426

    Duplicated Code

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

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

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

    Tuning

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

        const nylasConfigMock = sinon
          .stub(nylasUtils, 'getNylasConfig')
          .callsFake(() => {
            return Promise.resolve({
              NYLAS_CLIENT_ID: 'NYLAS_CLIENT_ID',
    Severity: Major
    Found in integrations/src/__tests__/nylas.test.ts and 5 other locations - About 50 mins to fix
    integrations/src/__tests__/nylas.test.ts on lines 132..139
    integrations/src/__tests__/nylas.test.ts on lines 239..246
    integrations/src/__tests__/nylas.test.ts on lines 295..302
    integrations/src/__tests__/nylasController.test.ts on lines 224..231
    integrations/src/__tests__/nylasController.test.ts on lines 419..426

    Duplicated Code

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

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

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

    Tuning

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

        const configMock = sinon
          .stub(nylasUtils, 'getNylasConfig')
          .callsFake(() => {
            return Promise.resolve({
              NYLAS_CLIENT_ID: 'NYLAS_CLIENT_ID',
    Severity: Major
    Found in integrations/src/__tests__/nylas.test.ts and 5 other locations - About 50 mins to fix
    integrations/src/__tests__/nylas.test.ts on lines 132..139
    integrations/src/__tests__/nylas.test.ts on lines 190..197
    integrations/src/__tests__/nylas.test.ts on lines 239..246
    integrations/src/__tests__/nylasController.test.ts on lines 224..231
    integrations/src/__tests__/nylasController.test.ts on lines 419..426

    Duplicated Code

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

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

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

    Tuning

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

        try {
          await nylasUtils.syncMessages(integration.nylasAccountId, '');
        } catch (e) {
          expect(e.message).toBe('Get message by id failed');
        }
    Severity: Minor
    Found in integrations/src/__tests__/nylas.test.ts and 1 other location - About 45 mins to fix
    integrations/src/__tests__/nylas.test.ts on lines 1133..1137

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

    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

        try {
          await nylasUtils.syncMessages(integration.nylasAccountId, '123');
        } catch (e) {
          expect(e.message).toBe('Customer getOrCreate failed');
        }
    Severity: Minor
    Found in integrations/src/__tests__/nylas.test.ts and 1 other location - About 45 mins to fix
    integrations/src/__tests__/nylas.test.ts on lines 1116..1120

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

    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

        try {
          await auth.connectExchangeToNylas(erxesApiId, {});
        } catch (e) {
          expect(e.message).toBe('Missing Exhange config');
        }
    Severity: Minor
    Found in integrations/src/__tests__/nylas.test.ts and 1 other location - About 35 mins to fix
    integrations/src/__tests__/nylas.test.ts on lines 169..173

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

    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

        expect(JSON.stringify(settingsO365)).toEqual(
          JSON.stringify({
            microsoft_client_id: 'MICROSOFT_CLIENT_ID',
            microsoft_client_secret: 'MICROSOFT_CLIENT_SECRET',
            microsoft_refresh_token: 'refreshToken'
    Severity: Minor
    Found in integrations/src/__tests__/nylas.test.ts and 1 other location - About 35 mins to fix
    integrations/src/__tests__/nylas.test.ts on lines 982..988

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

    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

        expect(JSON.stringify(settingsGoogle)).toEqual(
          JSON.stringify({
            google_client_id: 'GOOGLE_CLIENT_ID',
            google_client_secret: 'GOOGLE_CLIENT_SECRET',
            google_refresh_token: 'refreshToken'
    Severity: Minor
    Found in integrations/src/__tests__/nylas.test.ts and 1 other location - About 35 mins to fix
    integrations/src/__tests__/nylas.test.ts on lines 1002..1008

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

    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

        try {
          await auth.connectImapToNylas(erxesApiId, {});
        } catch (e) {
          expect(e.message).toBe('Missing imap config');
        }
    Severity: Minor
    Found in integrations/src/__tests__/nylas.test.ts and 1 other location - About 35 mins to fix
    integrations/src/__tests__/nylas.test.ts on lines 271..275

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

    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

        try {
          await auth.connectImapToNylas(erxesApiId, doc);
        } catch (e) {
          expect(e.message).toBe('Failed to integrate with the Nylas');
        }
    Severity: Minor
    Found in integrations/src/__tests__/nylas.test.ts and 1 other location - About 35 mins to fix
    integrations/src/__tests__/nylas.test.ts on lines 283..287

    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

        try {
          await auth.connectExchangeToNylas(erxesApiId, doc);
        } catch (e) {
          expect(e.message).toBe('Failed to integrate with the Nylas');
        }
    Severity: Minor
    Found in integrations/src/__tests__/nylas.test.ts and 1 other location - About 35 mins to fix
    integrations/src/__tests__/nylas.test.ts on lines 179..183

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 46.

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

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

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

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

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status