RocketChat/Rocket.Chat

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

Summary

Maintainability
F
1 wk
Test Coverage

Function createAccountSettings has 762 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    settingsRegistry.addGroup('Accounts', async function () {
        await this.section('Two Factor Authentication', async function () {
            const enable2FA = {
                _id: 'Accounts_TwoFactorAuthentication_Enabled',
                value: true,
Severity: Major
Found in apps/meteor/server/settings/accounts.ts - About 3 days to fix

    File accounts.ts has 767 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { Random } from '@rocket.chat/random';
    
    import { settingsRegistry } from '../../app/settings/server';
    
    export const createAccountSettings = () =>
    Severity: Major
    Found in apps/meteor/server/settings/accounts.ts - About 1 day to fix

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

                  await this.add('Accounts_Default_User_Preferences_alsoSendThreadToChannel', 'default', {
                      type: 'select',
                      values: [
                          {
                              key: 'default',
      Severity: Major
      Found in apps/meteor/server/settings/accounts.ts and 3 other locations - About 1 hr to fix
      apps/meteor/server/settings/accounts.ts on lines 520..538
      apps/meteor/server/settings/accounts.ts on lines 539..557
      apps/meteor/server/settings/accounts.ts on lines 618..636

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

      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

                  await this.add('Accounts_Default_User_Preferences_sidebarViewMode', 'medium', {
                      type: 'select',
                      values: [
                          {
                              key: 'extended',
      Severity: Major
      Found in apps/meteor/server/settings/accounts.ts and 3 other locations - About 1 hr to fix
      apps/meteor/server/settings/accounts.ts on lines 520..538
      apps/meteor/server/settings/accounts.ts on lines 592..610
      apps/meteor/server/settings/accounts.ts on lines 618..636

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

      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

                  await this.add('Accounts_Default_User_Preferences_sendOnEnter', 'normal', {
                      type: 'select',
                      values: [
                          {
                              key: 'normal',
      Severity: Major
      Found in apps/meteor/server/settings/accounts.ts and 3 other locations - About 1 hr to fix
      apps/meteor/server/settings/accounts.ts on lines 520..538
      apps/meteor/server/settings/accounts.ts on lines 539..557
      apps/meteor/server/settings/accounts.ts on lines 592..610

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

      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

                  await this.add('Accounts_Default_User_Preferences_themeAppearence', 'auto', {
                      type: 'select',
                      values: [
                          {
                              key: 'auto',
      Severity: Major
      Found in apps/meteor/server/settings/accounts.ts and 3 other locations - About 1 hr to fix
      apps/meteor/server/settings/accounts.ts on lines 539..557
      apps/meteor/server/settings/accounts.ts on lines 592..610
      apps/meteor/server/settings/accounts.ts on lines 618..636

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

      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

                  await this.add('Accounts_Default_User_Preferences_desktopNotifications', 'all', {
                      type: 'select',
                      values: [
                          {
                              key: 'all',
      Severity: Major
      Found in apps/meteor/server/settings/accounts.ts and 2 other locations - About 1 hr to fix
      apps/meteor/server/settings/accounts.ts on lines 447..464
      apps/meteor/server/settings/logs.ts on lines 5..22

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

      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

                  await this.add('Accounts_Default_User_Preferences_pushNotifications', 'all', {
                      type: 'select',
                      values: [
                          {
                              key: 'all',
      Severity: Major
      Found in apps/meteor/server/settings/accounts.ts and 2 other locations - About 1 hr to fix
      apps/meteor/server/settings/accounts.ts on lines 429..446
      apps/meteor/server/settings/logs.ts on lines 5..22

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

      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('Accounts_Default_User_Preferences_emailNotificationMode', 'mentions', {
                      type: 'select',
                      values: [
                          {
                              key: 'nothing',
      Severity: Major
      Found in apps/meteor/server/settings/accounts.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 652..666
      apps/meteor/server/settings/accounts.ts on lines 667..681
      apps/meteor/server/settings/email.ts on lines 188..202
      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 6 locations. Consider refactoring.
      Open

                  await this.add('Accounts_Default_User_Preferences_newRoomNotification', 'door', {
                      type: 'select',
                      values: [
                          {
                              key: 'none',
      Severity: Major
      Found in apps/meteor/server/settings/accounts.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 667..681
      apps/meteor/server/settings/email.ts on lines 188..202
      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 6 locations. Consider refactoring.
      Open

                  await this.add('Accounts_Default_User_Preferences_sidebarSortby', 'activity', {
                      type: 'select',
                      values: [
                          {
                              key: 'activity',
      Severity: Major
      Found in apps/meteor/server/settings/accounts.ts and 5 other locations - About 1 hr to fix
      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
      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 6 locations. Consider refactoring.
      Open

                  await this.add('Accounts_Default_User_Preferences_newMessageNotification', 'chime', {
                      type: 'select',
                      values: [
                          {
                              key: 'none',
      Severity: Major
      Found in apps/meteor/server/settings/accounts.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/email.ts on lines 188..202
      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 4 locations. Consider refactoring.
      Open

              await this.add('Accounts_Directory_DefaultView', 'channels', {
                  type: 'select',
                  values: [
                      {
                          key: 'channels',
      Severity: Major
      Found in apps/meteor/server/settings/accounts.ts and 3 other locations - About 1 hr to fix
      apps/meteor/server/settings/general.ts on lines 150..163
      apps/meteor/server/settings/general.ts on lines 164..177
      apps/meteor/server/settings/layout.ts on lines 186..199

      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

      There are no issues that match your filters.

      Category
      Status