RocketChat/Rocket.Chat

View on GitHub
apps/meteor/server/settings/email.ts

Summary

Maintainability
F
6 days
Test Coverage

Function createEmailSettings has 527 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    settingsRegistry.addGroup('Email', async function () {
        await this.section('Style', async function () {
            await this.add('email_plain_text_only', false, {
                type: 'boolean',
            });
Severity: Major
Found in apps/meteor/server/settings/email.ts - About 2 days to fix

    File email.ts has 531 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { settingsRegistry } from '../../app/settings/server';
    
    export const createEmailSettings = () =>
        settingsRegistry.addGroup('Email', async function () {
            await this.section('Style', async function () {
    Severity: Major
    Found in apps/meteor/server/settings/email.ts - About 1 day to fix

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

              await this.section('Email_changed_section', async function () {
                  await this.add('Email_Changed_Email_Subject', '{Email_Changed_Email_Subject}', {
                      type: 'string',
                      i18nLabel: 'Subject',
                  });
      Severity: Major
      Found in apps/meteor/server/settings/email.ts and 6 other locations - About 2 hrs to fix
      apps/meteor/ee/server/lib/deviceManagement/startup.ts on lines 14..30
      apps/meteor/server/settings/email.ts on lines 428..444
      apps/meteor/server/settings/email.ts on lines 446..463
      apps/meteor/server/settings/email.ts on lines 471..487
      apps/meteor/server/settings/email.ts on lines 494..511
      apps/meteor/server/settings/email.ts on lines 532..549

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

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

              await this.section('Invitation', async function () {
                  await this.add('Invitation_Subject', '{Invitation_Subject_Default}', {
                      type: 'string',
                      i18nLabel: 'Subject',
                  });
      Severity: Major
      Found in apps/meteor/server/settings/email.ts and 6 other locations - About 2 hrs to fix
      apps/meteor/ee/server/lib/deviceManagement/startup.ts on lines 14..30
      apps/meteor/server/settings/email.ts on lines 428..444
      apps/meteor/server/settings/email.ts on lines 446..463
      apps/meteor/server/settings/email.ts on lines 494..511
      apps/meteor/server/settings/email.ts on lines 513..530
      apps/meteor/server/settings/email.ts on lines 532..549

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

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

              await this.section('Password_changed_section', async function () {
                  await this.add('Password_Changed_Email_Subject', '{Password_Changed_Email_Subject}', {
                      type: 'string',
                      i18nLabel: 'Subject',
                  });
      Severity: Major
      Found in apps/meteor/server/settings/email.ts and 6 other locations - About 2 hrs to fix
      apps/meteor/ee/server/lib/deviceManagement/startup.ts on lines 14..30
      apps/meteor/server/settings/email.ts on lines 428..444
      apps/meteor/server/settings/email.ts on lines 446..463
      apps/meteor/server/settings/email.ts on lines 471..487
      apps/meteor/server/settings/email.ts on lines 494..511
      apps/meteor/server/settings/email.ts on lines 513..530

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

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

              await this.section('Verification', async function () {
                  await this.add('Verification_Email_Subject', '{Verification_Email_Subject}', {
                      type: 'string',
                      i18nLabel: 'Subject',
                  });
      Severity: Major
      Found in apps/meteor/server/settings/email.ts and 6 other locations - About 2 hrs to fix
      apps/meteor/ee/server/lib/deviceManagement/startup.ts on lines 14..30
      apps/meteor/server/settings/email.ts on lines 428..444
      apps/meteor/server/settings/email.ts on lines 471..487
      apps/meteor/server/settings/email.ts on lines 494..511
      apps/meteor/server/settings/email.ts on lines 513..530
      apps/meteor/server/settings/email.ts on lines 532..549

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

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

              await this.section('Forgot_password_section', async function () {
                  await this.add('Forgot_Password_Email_Subject', '{Forgot_Password_Email_Subject}', {
                      type: 'string',
                      i18nLabel: 'Subject',
                  });
      Severity: Major
      Found in apps/meteor/server/settings/email.ts and 6 other locations - About 2 hrs to fix
      apps/meteor/ee/server/lib/deviceManagement/startup.ts on lines 14..30
      apps/meteor/server/settings/email.ts on lines 428..444
      apps/meteor/server/settings/email.ts on lines 446..463
      apps/meteor/server/settings/email.ts on lines 471..487
      apps/meteor/server/settings/email.ts on lines 513..530
      apps/meteor/server/settings/email.ts on lines 532..549

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

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

              await this.section('Registration_via_Admin', async function () {
                  await this.add('Accounts_UserAddedEmail_Subject', '{Welcome_to}', {
                      type: 'string',
                      i18nLabel: 'Subject',
                  });
      Severity: Major
      Found in apps/meteor/server/settings/email.ts and 6 other locations - About 2 hrs to fix
      apps/meteor/ee/server/lib/deviceManagement/startup.ts on lines 14..30
      apps/meteor/server/settings/email.ts on lines 446..463
      apps/meteor/server/settings/email.ts on lines 471..487
      apps/meteor/server/settings/email.ts on lines 494..511
      apps/meteor/server/settings/email.ts on lines 513..530
      apps/meteor/server/settings/email.ts on lines 532..549

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

      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

                  await this.add('SMTP_Protocol', 'smtp', {
                      type: 'select',
                      values: [
                          {
                              key: 'smtp',
      Severity: Major
      Found in apps/meteor/server/settings/email.ts and 5 other locations - About 1 hr to fix
      apps/meteor/server/settings/accounts.ts on lines 570..584
      apps/meteor/server/settings/accounts.ts on lines 637..651
      apps/meteor/server/settings/accounts.ts on lines 652..666
      apps/meteor/server/settings/accounts.ts on lines 667..681
      apps/meteor/server/settings/email.ts on lines 188..202

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

      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

                  await this.add('Direct_Reply_Protocol', 'IMAP', {
                      type: 'select',
                      values: [
                          {
                              key: 'IMAP',
      Severity: Major
      Found in apps/meteor/server/settings/email.ts and 5 other locations - About 1 hr to fix
      apps/meteor/server/settings/accounts.ts on lines 570..584
      apps/meteor/server/settings/accounts.ts on lines 637..651
      apps/meteor/server/settings/accounts.ts on lines 652..666
      apps/meteor/server/settings/accounts.ts on lines 667..681
      apps/meteor/server/settings/email.ts on lines 341..355

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

      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

                  await this.add('Direct_Reply_Delete', true, {
                      type: 'boolean',
                      env: true,
                      i18nLabel: 'Direct_Reply_Delete',
                      enableQuery: {
      Severity: Minor
      Found in apps/meteor/server/settings/email.ts and 1 other location - About 35 mins to fix
      apps/meteor/server/settings/email.ts on lines 366..374

      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

                  await this.add('SMTP_IgnoreTLS', true, {
                      type: 'boolean',
                      env: true,
                      i18nLabel: 'IgnoreTLS',
                      enableQuery: {
      Severity: Minor
      Found in apps/meteor/server/settings/email.ts and 1 other location - About 35 mins to fix
      apps/meteor/server/settings/email.ts on lines 227..235

      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

      There are no issues that match your filters.

      Category
      Status