RocketChat/Rocket.Chat

View on GitHub
apps/meteor/app/importer/server/classes/ImportDataConverter.ts

Summary

Maintainability
F
1 wk
Test Coverage

File ImportDataConverter.ts has 975 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import type {
    IImportUser,
    IImportMessage,
    IImportMessageReaction,
    IImportChannel,
Severity: Major
Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 2 days to fix

    ImportDataConverter has 54 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class ImportDataConverter {
        private _userCache: Map<string, IUserIdentification>;
    
        // display name uses a different cache because it's only used on mentions so we don't need to load it every time we load an user
        private _userDisplayNameCache: Map<string, string>;
    Severity: Major
    Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 7 hrs to fix

      Function convertUsers has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
      Open

          public async convertUsers({ beforeImportFn, afterImportFn, onErrorFn, afterBatchFn }: IConversionCallbacks = {}): Promise<void> {
              const users = (await this.getUsersToImport()) as IImportUserRecord[];
      
              const insertedIds = new Set<IUser['_id']>();
              const updatedIds = new Set<IUser['_id']>();
      Severity: Minor
      Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 6 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function convertMessages has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

          async convertMessages({
              beforeImportFn,
              afterImportFn,
              onErrorFn,
              afterImportAllMessagesFn,
      Severity: Minor
      Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 5 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function convertUsers has 90 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public async convertUsers({ beforeImportFn, afterImportFn, onErrorFn, afterBatchFn }: IConversionCallbacks = {}): Promise<void> {
              const users = (await this.getUsersToImport()) as IImportUserRecord[];
      
              const insertedIds = new Set<IUser['_id']>();
              const updatedIds = new Set<IUser['_id']>();
      Severity: Major
      Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 3 hrs to fix

        Function convertMessages has 87 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            async convertMessages({
                beforeImportFn,
                afterImportFn,
                onErrorFn,
                afterImportAllMessagesFn,
        Severity: Major
        Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 3 hrs to fix

          Function convertChannels has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              async convertChannels(startedByUserId: string, { beforeImportFn, afterImportFn, onErrorFn }: IConversionCallbacks = {}): Promise<void> {
                  const channels = await this.getChannelsToImport();
                  for await (const record of channels) {
                      const { data, _id } = record;
                      if (this.aborted) {
          Severity: Minor
          Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 3 hrs to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function insertRoom has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              async insertRoom(roomData: IImportChannel, startedByUserId: string): Promise<void> {
                  // Find the rocketchatId of the user who created this channel
                  const creatorId = await this.getRoomCreatorId(roomData, startedByUserId);
                  const members = await this.convertImportedIdsToUsernames(roomData.users, roomData.t !== 'd' ? creatorId : undefined);
          
          
          Severity: Minor
          Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 1 hr to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function updateUser has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              async updateUser(existingUser: IUser, userData: IImportUser): Promise<void> {
                  const { _id } = existingUser;
          
                  userData._id = _id;
          
          
          Severity: Minor
          Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 1 hr to fix

            Function convertMessageReactions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                async convertMessageReactions(importedReactions: Record<string, IImportMessageReaction>): Promise<undefined | IMessageReactions> {
                    const reactions: IMessageReactions = {};
            
                    for await (const name of Object.keys(importedReactions)) {
                        if (!importedReactions.hasOwnProperty(name)) {
            Severity: Minor
            Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 1 hr to fix

            Cognitive Complexity

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

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

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

            Further reading

            Function convertChannels has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                async convertChannels(startedByUserId: string, { beforeImportFn, afterImportFn, onErrorFn }: IConversionCallbacks = {}): Promise<void> {
                    const channels = await this.getChannelsToImport();
                    for await (const record of channels) {
                        const { data, _id } = record;
                        if (this.aborted) {
            Severity: Minor
            Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 1 hr to fix

              Function insertRoom has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  async insertRoom(roomData: IImportChannel, startedByUserId: string): Promise<void> {
                      // Find the rocketchatId of the user who created this channel
                      const creatorId = await this.getRoomCreatorId(roomData, startedByUserId);
                      const members = await this.convertImportedIdsToUsernames(roomData.users, roomData.t !== 'd' ? creatorId : undefined);
              
              
              Severity: Minor
              Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 1 hr to fix

                Function getRoomCreatorId has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    async getRoomCreatorId(roomData: IImportChannel, startedByUserId: string): Promise<string> {
                        if (roomData.u) {
                            const creatorId = await this.findImportedUserId(roomData.u._id);
                            if (creatorId) {
                                return creatorId;
                Severity: Minor
                Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 1 hr to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function updateUser has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    async updateUser(existingUser: IUser, userData: IImportUser): Promise<void> {
                        const { _id } = existingUser;
                
                        userData._id = _id;
                
                
                Severity: Minor
                Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 1 hr to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function convertMessageMentions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    async convertMessageMentions(message: IImportMessage): Promise<Array<IMentionedUser> | undefined> {
                        const { mentions } = message;
                        if (!mentions) {
                            return undefined;
                        }
                Severity: Minor
                Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 1 hr to fix

                  Function addCustomFields has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      addCustomFields(updateData: Record<string, any>, userData: IImportUser): void {
                          if (!userData.customFields) {
                              return;
                          }
                  
                  
                  Severity: Minor
                  Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 1 hr to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Function convertMessageReactions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      async convertMessageReactions(importedReactions: Record<string, IImportMessageReaction>): Promise<undefined | IMessageReactions> {
                          const reactions: IMessageReactions = {};
                  
                          for await (const name of Object.keys(importedReactions)) {
                              if (!importedReactions.hasOwnProperty(name)) {
                  Severity: Minor
                  Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 1 hr to fix

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

                        addUserServices(updateData: Record<string, any>, userData: IImportUser): void {
                            if (!userData.services) {
                                return;
                            }
                    
                    
                    Severity: Minor
                    Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 55 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

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

                        async convertMessageMentions(message: IImportMessage): Promise<Array<IMentionedUser> | undefined> {
                            const { mentions } = message;
                            if (!mentions) {
                                return undefined;
                            }
                    Severity: Minor
                    Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 55 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Function findExistingRoom has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        async findExistingRoom(data: IImportChannel): Promise<IRoom | null> {
                            if (data._id && data._id.toUpperCase() === 'GENERAL') {
                                const room = await Rooms.findOneById('GENERAL', {});
                                // Prevent the importer from trying to create a new general
                                if (!room) {
                    Severity: Minor
                    Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 45 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Function findImportedUserDisplayName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        async findImportedUserDisplayName(importId: string): Promise<string | undefined> {
                            const options = {
                                projection: {
                                    _id: 1,
                                    name: 1,
                    Severity: Minor
                    Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 35 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Avoid too many return statements within this function.
                    Open

                                        return false;
                    Severity: Major
                    Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 30 mins to fix

                      Function findImportedRoomName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          async findImportedRoomName(importId: string): Promise<string | undefined> {
                              if (this._roomNameCache.has(importId)) {
                                  return this._roomNameCache.get(importId) as string;
                              }
                      
                      
                      Severity: Minor
                      Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts - About 25 mins to fix

                      Cognitive Complexity

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

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

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

                      Further reading

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

                          username
                              .replace(/\W/g, ' ')
                              .replace(/\s(.)/g, (u) => u.toUpperCase())
                              .replace(/^(.)/, (u) => u.toLowerCase())
                              .replace(/^\w/, (u) => u.toUpperCase());
                      apps/meteor/app/meteor-accounts-saml/server/lib/SAML.ts on lines 467..471

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

                      export type IConverterOptions = {
                          flagEmailsAsVerified?: boolean;
                          skipExistingUsers?: boolean;
                          skipNewUsers?: boolean;
                          skipUserCallbacks?: boolean;
                      packages/core-typings/src/OmichannelRoutingConfig.ts on lines 3..11
                      packages/core-typings/src/omnichannel/routing.ts on lines 7..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

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

                                  try {
                                      if (beforeImportFn && !(await beforeImportFn(record))) {
                                          await this.skipRecord(_id);
                                          continue;
                                      }
                      apps/meteor/app/importer/server/classes/ImportDataConverter.ts on lines 733..809

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 55.

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

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

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

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

                      Refactorings

                      Further Reading

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

                                  try {
                                      if (beforeImportFn && !(await beforeImportFn(record))) {
                                          await this.skipRecord(_id);
                                          continue;
                                      }
                      apps/meteor/app/importer/server/classes/ImportDataConverter.ts on lines 1115..1152

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 55.

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

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

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

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

                      Refactorings

                      Further Reading

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

                          async findImportedUserId(_id: string): Promise<string | undefined> {
                              const data = await this.findImportedUser(_id);
                              return data?._id;
                          }
                      Severity: Minor
                      Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts and 1 other location - About 45 mins to fix
                      apps/meteor/app/importer/server/classes/ImportDataConverter.ts on lines 916..919

                      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

                          async findImportedUsername(_id: string): Promise<string | undefined> {
                              const data = await this.findImportedUser(_id);
                              return data?.username;
                          }
                      Severity: Minor
                      Found in apps/meteor/app/importer/server/classes/ImportDataConverter.ts and 1 other location - About 45 mins to fix
                      apps/meteor/app/importer/server/classes/ImportDataConverter.ts on lines 911..914

                      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

                      There are no issues that match your filters.

                      Category
                      Status