RocketChat/Rocket.Chat

View on GitHub
apps/meteor/ee/app/livechat-enterprise/server/settings.ts

Summary

Maintainability
F
3 days
Test Coverage

Function createSettings has 297 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const createSettings = async (): Promise<void> => {
    await settingsRegistry.add('Livechat_abandoned_rooms_action', 'none', {
        type: 'select',
        group: 'Omnichannel',
        section: 'Sessions',
Severity: Major
Found in apps/meteor/ee/app/livechat-enterprise/server/settings.ts - About 1 day to fix

    File settings.ts has 304 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { OmnichannelSortingMechanismSettingType } from '@rocket.chat/core-typings';
    import { Settings } from '@rocket.chat/models';
    
    import { settingsRegistry } from '../../../../app/settings/server';
    
    
    Severity: Minor
    Found in apps/meteor/ee/app/livechat-enterprise/server/settings.ts - About 3 hrs to fix

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

                  await this.add('Livechat_maximum_chats_per_agent', 0, {
                      type: 'int',
                      group: 'Omnichannel',
                      section: 'Queue_management',
                      i18nLabel: 'Max_number_of_chats_per_agent',
      Severity: Major
      Found in apps/meteor/ee/app/livechat-enterprise/server/settings.ts and 1 other location - About 2 hrs to fix
      apps/meteor/ee/app/livechat-enterprise/server/settings.ts on lines 128..138

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

      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('Livechat_number_most_recent_chats_estimate_wait_time', 100, {
                      type: 'int',
                      group: 'Omnichannel',
                      section: 'Queue_management',
                      i18nLabel: 'Number_of_most_recent_chats_estimate_wait_time',
      Severity: Major
      Found in apps/meteor/ee/app/livechat-enterprise/server/settings.ts and 1 other location - About 2 hrs to fix
      apps/meteor/ee/app/livechat-enterprise/server/settings.ts on lines 105..115

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

      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 settingsRegistry.add('Livechat_AdditionalWidgetScripts', '', {
              type: 'string',
              group: 'Omnichannel',
              section: 'Livechat',
              enterprise: true,
      Severity: Major
      Found in apps/meteor/ee/app/livechat-enterprise/server/settings.ts and 1 other location - About 1 hr to fix
      apps/meteor/ee/app/livechat-enterprise/server/settings.ts on lines 184..195

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

      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 settingsRegistry.add('Livechat_WidgetLayoutClasses', '', {
              type: 'string',
              group: 'Omnichannel',
              section: 'Livechat',
              enterprise: true,
      Severity: Major
      Found in apps/meteor/ee/app/livechat-enterprise/server/settings.ts and 1 other location - About 1 hr to fix
      apps/meteor/ee/app/livechat-enterprise/server/settings.ts on lines 171..182

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

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

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

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

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

      Refactorings

      Further Reading

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

              values: [
                  { key: 'uj', i18nLabel: 'Message_HideType_uj' },
                  { key: 'ul', i18nLabel: 'Message_HideType_ul' },
                  { key: 'livechat-close', i18nLabel: 'Message_HideType_livechat_closed' },
                  { key: 'livechat-started', i18nLabel: 'Message_HideType_livechat_started' },
      Severity: Major
      Found in apps/meteor/ee/app/livechat-enterprise/server/settings.ts and 4 other locations - About 1 hr to fix
      apps/meteor/ee/server/settings/ldap.ts on lines 34..55
      apps/meteor/server/settings/crowd.ts on lines 38..59
      apps/meteor/server/settings/file-upload.ts on lines 69..90
      ee/packages/pdf-worker/src/templates/ChatTranscript/ChatTranscript.fixtures.ts on lines 51..57

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

      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 settingsRegistry.add('Livechat_auto_transfer_chat_timeout', 0, {
              type: 'int',
              group: 'Omnichannel',
              section: 'Sessions',
              i18nDescription: 'Livechat_auto_transfer_chat_timeout_description',
      Severity: Major
      Found in apps/meteor/ee/app/livechat-enterprise/server/settings.ts and 1 other location - About 1 hr to fix
      apps/meteor/ee/app/livechat-enterprise/server/settings.ts on lines 37..46

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

      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 settingsRegistry.add('Omnichannel_max_fallback_forward_depth', 3, {
              type: 'int',
              group: 'Omnichannel',
              section: 'Routing',
              i18nLabel: 'Omnichannel_max_fallback_forward_depth',
      Severity: Major
      Found in apps/meteor/ee/app/livechat-enterprise/server/settings.ts and 1 other location - About 1 hr to fix
      apps/meteor/ee/app/livechat-enterprise/server/settings.ts on lines 290..299

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

      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 settingsRegistry.add('Livechat_allow_manual_on_hold', false, {
              type: 'boolean',
              group: 'Omnichannel',
              section: 'Sessions',
              enterprise: true,
      Severity: Major
      Found in apps/meteor/ee/app/livechat-enterprise/server/settings.ts and 1 other location - About 1 hr to fix
      apps/meteor/ee/app/canned-responses/server/settings.ts on lines 6..15

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

      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 settingsRegistry.add('Livechat_last_chatted_agent_routing', false, {
              type: 'boolean',
              group: 'Omnichannel',
              section: 'Routing',
              enterprise: true,
      Severity: Minor
      Found in apps/meteor/ee/app/livechat-enterprise/server/settings.ts and 1 other location - About 55 mins to fix
      apps/meteor/ee/app/livechat-enterprise/server/settings.ts on lines 238..246

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

      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 settingsRegistry.add('Omnichannel_contact_manager_routing', true, {
              type: 'boolean',
              group: 'Omnichannel',
              section: 'Routing',
              enterprise: true,
      Severity: Minor
      Found in apps/meteor/ee/app/livechat-enterprise/server/settings.ts and 1 other location - About 55 mins to fix
      apps/meteor/ee/app/livechat-enterprise/server/settings.ts on lines 48..56

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

      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