RocketChat/Rocket.Chat

View on GitHub
apps/meteor/app/importer-slack/server/SlackImporter.ts

Summary

Maintainability
F
1 wk
Test Coverage

File SlackImporter.ts has 614 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import type { IImportUser, IImportMessage, IImportPendingFile } from '@rocket.chat/core-typings';
import { Messages, Settings, ImportData } from '@rocket.chat/models';
import type { IZipEntry } from 'adm-zip';

import { Importer, ProgressStep, ImporterWebsocket } from '../../importer/server';
Severity: Major
Found in apps/meteor/app/importer-slack/server/SlackImporter.ts - About 1 day to fix

    Function prepareMessageObject has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
    Open

        async prepareMessageObject(message: SlackMessage, missedTypes: Record<string, SlackMessage>, slackChannelId: string): Promise<void> {
            const id = this.makeSlackMessageId(slackChannelId, message.ts);
            const newMessage: IImportMessage = {
                _id: id,
                rid: slackChannelId,
    Severity: Minor
    Found in apps/meteor/app/importer-slack/server/SlackImporter.ts - About 1 day 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 prepareUsingLocalFile has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
    Open

        async prepareUsingLocalFile(fullFilePath: string): Promise<ImporterProgress> {
            this.logger.debug('start preparing import operation');
            await this.converter.clearImportData();
    
            const zip = new this.AdmZip(fullFilePath);
    Severity: Minor
    Found in apps/meteor/app/importer-slack/server/SlackImporter.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 prepareUsingLocalFile has 109 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        async prepareUsingLocalFile(fullFilePath: string): Promise<ImporterProgress> {
            this.logger.debug('start preparing import operation');
            await this.converter.clearImportData();
    
            const zip = new this.AdmZip(fullFilePath);
    Severity: Major
    Found in apps/meteor/app/importer-slack/server/SlackImporter.ts - About 4 hrs to fix

      Function prepareMessageObject has 101 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          async prepareMessageObject(message: SlackMessage, missedTypes: Record<string, SlackMessage>, slackChannelId: string): Promise<void> {
              const id = this.makeSlackMessageId(slackChannelId, message.ts);
              const newMessage: IImportMessage = {
                  _id: id,
                  rid: slackChannelId,
      Severity: Major
      Found in apps/meteor/app/importer-slack/server/SlackImporter.ts - About 4 hrs to fix

        Function processMessageSubType has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            async processMessageSubType(
                message: SlackMessage,
                slackChannelId: string,
                newMessage: IImportMessage,
                missedTypes: Record<string, SlackMessage>,
        Severity: Major
        Found in apps/meteor/app/importer-slack/server/SlackImporter.ts - About 2 hrs to fix

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

              async processMessageSubType(
                  message: SlackMessage,
                  slackChannelId: string,
                  newMessage: IImportMessage,
                  missedTypes: Record<string, SlackMessage>,
          Severity: Minor
          Found in apps/meteor/app/importer-slack/server/SlackImporter.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 prepareUsersFile has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              async prepareUsersFile(entry: IZipEntry): Promise<number> {
                  await super.updateProgress(ProgressStep.PREPARING_USERS);
                  const data = JSON.parse(entry.getData().toString()) as SlackUser[];
          
                  this.logger.debug(`loaded ${data.length} users.`);
          Severity: Minor
          Found in apps/meteor/app/importer-slack/server/SlackImporter.ts - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (message.reply_users) {
                                        const replies = new Set<string>();
                                        message.reply_users.forEach((item: string) => {
                                            replies.add(this._replaceSlackUserId(item));
                                        });
            Severity: Major
            Found in apps/meteor/app/importer-slack/server/SlackImporter.ts - About 45 mins to fix

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

                  async prepareChannelsFile(entry: IZipEntry): Promise<number> {
                      await super.updateProgress(ProgressStep.PREPARING_CHANNELS);
                      const data = (JSON.parse(entry.getData().toString()) as SlackChannel[]).filter(
                          (channel): channel is SlackChannel & { creator: string } => 'creator' in channel && channel.creator != null,
                      );
              Severity: Minor
              Found in apps/meteor/app/importer-slack/server/SlackImporter.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

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

                  async prepareMpimpsFile(entry: IZipEntry): Promise<number> {
                      await super.updateProgress(ProgressStep.PREPARING_CHANNELS);
                      const data = (JSON.parse(entry.getData().toString()) as SlackChannel[]).filter(
                          (channel): channel is SlackChannel & { creator: string } => 'creator' in channel && channel.creator != null,
                      );
              Severity: Minor
              Found in apps/meteor/app/importer-slack/server/SlackImporter.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

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

                  async prepareUsersFile(entry: IZipEntry): Promise<number> {
                      await super.updateProgress(ProgressStep.PREPARING_USERS);
                      const data = JSON.parse(entry.getData().toString()) as SlackUser[];
              
                      this.logger.debug(`loaded ${data.length} users.`);
              Severity: Minor
              Found in apps/meteor/app/importer-slack/server/SlackImporter.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 true;
              Severity: Major
              Found in apps/meteor/app/importer-slack/server/SlackImporter.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

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

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

                      parseMentions(newMessage: IImportMessage): void {
                          const mentionsParser = new MentionsParser({
                              pattern: () => '[0-9a-zA-Z]+',
                              useRealName: () => settings.get<boolean>('UI_Use_Real_Name'),
                              me: () => 'me',
                  Severity: Minor
                  Found in apps/meteor/app/importer-slack/server/SlackImporter.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

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

                          const increaseProgress = () => {
                              try {
                                  count++;
                                  const rate = Math.floor((count * 1000) / totalEntries) / 10;
                                  if (rate > oldRate) {
                  Severity: Major
                  Found in apps/meteor/app/importer-slack/server/SlackImporter.ts and 1 other location - About 3 hrs to fix
                  apps/meteor/app/importer-csv/server/CsvImporter.ts on lines 32..43

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

                  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

                          const data = (JSON.parse(entry.getData().toString()) as SlackChannel[]).filter(
                              (channel): channel is SlackChannel & { creator: string } => 'creator' in channel && channel.creator != null,
                          );
                  Severity: Major
                  Found in apps/meteor/app/importer-slack/server/SlackImporter.ts and 2 other locations - About 2 hrs to fix
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 123..125
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 153..155

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

                  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

                          const data = (JSON.parse(entry.getData().toString()) as SlackChannel[]).filter(
                              (channel): channel is SlackChannel & { creator: string } => 'creator' in channel && channel.creator != null,
                          );
                  Severity: Major
                  Found in apps/meteor/app/importer-slack/server/SlackImporter.ts and 2 other locations - About 2 hrs to fix
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 153..155
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 182..184

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

                  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

                          const data = (JSON.parse(entry.getData().toString()) as SlackChannel[]).filter(
                              (channel): channel is SlackChannel & { creator: string } => 'creator' in channel && channel.creator != null,
                          );
                  Severity: Major
                  Found in apps/meteor/app/importer-slack/server/SlackImporter.ts and 2 other locations - About 2 hrs to fix
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 123..125
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 182..184

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

                  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

                                      if (entry.entryName === 'channels.json') {
                                          channelCount += await this.prepareChannelsFile(entry);
                                          await this.updateRecord({ 'count.channels': channelCount });
                                          increaseProgress();
                                          continue;
                  Severity: Major
                  Found in apps/meteor/app/importer-slack/server/SlackImporter.ts and 3 other locations - About 1 hr to fix
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 308..313
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 315..320
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 322..327

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

                                      if (entry.entryName === 'groups.json') {
                                          channelCount += await this.prepareGroupsFile(entry);
                                          await this.updateRecord({ 'count.channels': channelCount });
                                          increaseProgress();
                                          continue;
                  Severity: Major
                  Found in apps/meteor/app/importer-slack/server/SlackImporter.ts and 3 other locations - About 1 hr to fix
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 301..306
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 315..320
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 322..327

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

                                      if (entry.entryName === 'dms.json') {
                                          channelCount += await this.prepareDMsFile(entry);
                                          await this.updateRecord({ 'count.channels': channelCount });
                                          increaseProgress();
                                          continue;
                  Severity: Major
                  Found in apps/meteor/app/importer-slack/server/SlackImporter.ts and 3 other locations - About 1 hr to fix
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 301..306
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 308..313
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 315..320

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

                                      if (entry.entryName === 'mpims.json') {
                                          channelCount += await this.prepareMpimpsFile(entry);
                                          await this.updateRecord({ 'count.channels': channelCount });
                                          increaseProgress();
                                          continue;
                  Severity: Major
                  Found in apps/meteor/app/importer-slack/server/SlackImporter.ts and 3 other locations - About 1 hr to fix
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 301..306
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 308..313
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 322..327

                  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

                          if (users.length) {
                              if (!newMessage.mentions) {
                                  newMessage.mentions = [];
                              }
                              newMessage.mentions.push(...users);
                  Severity: Minor
                  Found in apps/meteor/app/importer-slack/server/SlackImporter.ts and 1 other location - About 55 mins to fix
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 430..435

                  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

                          if (channels.length) {
                              if (!newMessage.channels) {
                                  newMessage.channels = [];
                              }
                              newMessage.channels.push(...channels);
                  Severity: Minor
                  Found in apps/meteor/app/importer-slack/server/SlackImporter.ts and 1 other location - About 55 mins to fix
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 419..424

                  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

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

                                      if (message.thread_ts && message.thread_ts !== message.ts) {
                                          fileMessage.tmid = this.makeSlackMessageId(slackChannelId, message.thread_ts);
                                      }
                  Severity: Minor
                  Found in apps/meteor/app/importer-slack/server/SlackImporter.ts and 1 other location - About 50 mins to fix
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 571..573

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 51.

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

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

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

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

                  Refactorings

                  Further Reading

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

                                      if (message.thread_ts && message.thread_ts !== message.ts) {
                                          fileMessage.tmid = this.makeSlackMessageId(slackChannelId, message.thread_ts);
                                      }
                  Severity: Minor
                  Found in apps/meteor/app/importer-slack/server/SlackImporter.ts and 1 other location - About 50 mins to fix
                  apps/meteor/app/importer-slack/server/SlackImporter.ts on lines 502..504

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 51.

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

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

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

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

                  Refactorings

                  Further Reading

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

                      profile: {
                          real_name: string;
                          email: string;
                          image_512: string;
                          image_original: string;
                  Severity: Major
                  Found in apps/meteor/app/importer-slack/server/SlackImporter.ts and 2 other locations - About 45 mins to fix
                  packages/core-typings/src/IServerInfo.ts on lines 12..19
                  packages/rest-typings/src/default/index.ts on lines 17..24

                  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