RocketChat/Rocket.Chat

View on GitHub
apps/meteor/server/services/federation/application/room/receiver/RoomServiceReceiver.ts

Summary

Maintainability
F
1 wk
Test Coverage

File RoomServiceReceiver.ts has 722 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// TODO: Refactor this file splitting it into smaller files + removing the complexity of the most important method (changeMembership)
import { RoomType } from '@rocket.chat/apps-engine/definition/rooms';
import { isDirectMessageRoom, isQuoteAttachment } from '@rocket.chat/core-typings';

import { DirectMessageFederatedRoom, FederatedRoom } from '../../../domain/FederatedRoom';

    Function onChangeRoomMembership has 136 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public async onChangeRoomMembership(roomChangeMembershipInput: FederationRoomChangeMembershipDto): Promise<void> {
            const {
                externalRoomId,
                normalizedInviteeId,
                normalizedRoomId,

      Function onChangeRoomMembership has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          public async onChangeRoomMembership(roomChangeMembershipInput: FederationRoomChangeMembershipDto): Promise<void> {
              const {
                  externalRoomId,
                  normalizedInviteeId,
                  normalizedRoomId,

      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 whenUserIsJoiningByHimself has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private async whenUserIsJoiningByHimself(
              externalRoomId: string,
              normalizedRoomId: string,
              federatedInviterUser: FederatedUser,
              federatedInviteeUser: FederatedUser,

        Function onExternalThreadedFileMessageReceived has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public async onExternalThreadedFileMessageReceived(
                roomReceiveExternalMessageInput: FederationRoomReceiveExternalFileMessageDto,
            ): Promise<void> {
                const { externalRoomId, externalSenderId, messageBody, externalEventId, replyToEventId, thread } = roomReceiveExternalMessageInput;
        
        

          Function onExternalMessageEditedReceived has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public async onExternalMessageEditedReceived(roomEditExternalMessageInput: FederationRoomEditExternalMessageDto): Promise<void> {
                  const { externalRoomId, externalSenderId, editsEvent, newExternalFormattedText, newRawMessage } = roomEditExternalMessageInput;
          
                  const federatedRoom = await this.internalRoomAdapter.getFederatedRoomByExternalId(externalRoomId);
                  if (!federatedRoom) {

            Function onExternalThreadedMessageReceived has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public async onExternalThreadedMessageReceived(roomReceiveExternalMessageInput: FederationRoomReceiveExternalMessageDto): Promise<void> {
                    const { externalRoomId, externalSenderId, rawMessage, externalFormattedText, externalEventId, replyToEventId, thread } =
                        roomReceiveExternalMessageInput;
                    if (!thread?.rootEventId) {
                        return;

              Function onExternalFileMessageReceived has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public async onExternalFileMessageReceived(roomReceiveExternalMessageInput: FederationRoomReceiveExternalFileMessageDto): Promise<void> {
                      const { externalRoomId, externalSenderId, messageBody, externalEventId, replyToEventId } = roomReceiveExternalMessageInput;
              
                      const federatedRoom = await this.internalRoomAdapter.getFederatedRoomByExternalId(externalRoomId);
                      if (!federatedRoom) {

                Function handleDMRoomInviteWhenAllUsersWereBeingProvidedInTheCreationalEvent has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private async handleDMRoomInviteWhenAllUsersWereBeingProvidedInTheCreationalEvent(
                        allInviteesExternalIds: {
                            externalInviteeId: string;
                            normalizedInviteeId: string;
                            inviteeUsernameOnly: string;

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

                      public async onExternalMessageReceived(roomReceiveExternalMessageInput: FederationRoomReceiveExternalMessageDto): Promise<void> {
                          const { externalRoomId, externalSenderId, rawMessage, externalFormattedText, externalEventId, replyToEventId } =
                              roomReceiveExternalMessageInput;
                          const federatedRoom = await this.internalRoomAdapter.getFederatedRoomByExternalId(externalRoomId);
                          if (!federatedRoom) {

                    Function onChangeRoomPowerLevels has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public async onChangeRoomPowerLevels(roomPowerLevelsInput: FederationRoomRoomChangePowerLevelsEventDto): Promise<void> {
                            const { externalRoomId, roleChangesToApply = {}, externalSenderId } = roomPowerLevelsInput;
                    
                            const federatedRoom = await this.internalRoomAdapter.getFederatedRoomByExternalId(externalRoomId);
                            if (!federatedRoom) {

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

                          private async whenUserIsJoiningByHimself(
                              externalRoomId: string,
                              normalizedRoomId: string,
                              federatedInviterUser: FederatedUser,
                              federatedInviteeUser: FederatedUser,

                      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 onExternalMessageEditedReceived has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public async onExternalMessageEditedReceived(roomEditExternalMessageInput: FederationRoomEditExternalMessageDto): Promise<void> {
                              const { externalRoomId, externalSenderId, editsEvent, newExternalFormattedText, newRawMessage } = roomEditExternalMessageInput;
                      
                              const federatedRoom = await this.internalRoomAdapter.getFederatedRoomByExternalId(externalRoomId);
                              if (!federatedRoom) {

                      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 onExternalThreadedMessageReceived has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public async onExternalThreadedMessageReceived(roomReceiveExternalMessageInput: FederationRoomReceiveExternalMessageDto): Promise<void> {
                              const { externalRoomId, externalSenderId, rawMessage, externalFormattedText, externalEventId, replyToEventId, thread } =
                                  roomReceiveExternalMessageInput;
                              if (!thread?.rootEventId) {
                                  return;

                      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 onExternalThreadedFileMessageReceived has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public async onExternalThreadedFileMessageReceived(
                              roomReceiveExternalMessageInput: FederationRoomReceiveExternalFileMessageDto,
                          ): Promise<void> {
                              const { externalRoomId, externalSenderId, messageBody, externalEventId, replyToEventId, thread } = roomReceiveExternalMessageInput;
                      
                      

                      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 this.handleDMRoomInviteWhenNotifiedByRegularEventsOnly(federatedInviteeUser, federatedInviterUser, externalRoomId);

                        Avoid too many return statements within this function.
                        Open

                                    return;

                          Avoid too many return statements within this function.
                          Open

                                          return;

                            Avoid too many return statements within this function.
                            Open

                                        return;

                              Avoid too many return statements within this function.
                              Open

                                          return;

                                Avoid too many return statements within this function.
                                Open

                                            return;

                                  Avoid too many return statements within this function.
                                  Open

                                                  return;

                                    Avoid too many return statements within this function.
                                    Open

                                                return;

                                      Avoid too many return statements within this function.
                                      Open

                                                  return;

                                        Avoid too many return statements within this function.
                                        Open

                                                    return;

                                          Avoid too many return statements within this function.
                                          Open

                                                          return;

                                            Avoid too many return statements within this function.
                                            Open

                                                            return;

                                              Avoid too many return statements within this function.
                                              Open

                                                          return;

                                                Avoid too many return statements within this function.
                                                Open

                                                            return;

                                                  Avoid too many return statements within this function.
                                                  Open

                                                              return;

                                                    Avoid too many return statements within this function.
                                                    Open

                                                                return;

                                                      Avoid too many return statements within this function.
                                                      Open

                                                                  return;

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                    return;

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                          return;

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                        return;

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

                                                                  public async onExternalMessageReceived(roomReceiveExternalMessageInput: FederationRoomReceiveExternalMessageDto): Promise<void> {
                                                                      const { externalRoomId, externalSenderId, rawMessage, externalFormattedText, externalEventId, replyToEventId } =
                                                                          roomReceiveExternalMessageInput;
                                                                      const federatedRoom = await this.internalRoomAdapter.getFederatedRoomByExternalId(externalRoomId);
                                                                      if (!federatedRoom) {

                                                              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 onExternalFileMessageReceived has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                              Open

                                                                  public async onExternalFileMessageReceived(roomReceiveExternalMessageInput: FederationRoomReceiveExternalFileMessageDto): Promise<void> {
                                                                      const { externalRoomId, externalSenderId, messageBody, externalEventId, replyToEventId } = roomReceiveExternalMessageInput;
                                                              
                                                                      const federatedRoom = await this.internalRoomAdapter.getFederatedRoomByExternalId(externalRoomId);
                                                                      if (!federatedRoom) {

                                                              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 handleDMRoomInviteWhenAllUsersWereBeingProvidedInTheCreationalEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                              Open

                                                                  private async handleDMRoomInviteWhenAllUsersWereBeingProvidedInTheCreationalEvent(
                                                                      allInviteesExternalIds: {
                                                                          externalInviteeId: string;
                                                                          normalizedInviteeId: string;
                                                                          inviteeUsernameOnly: string;

                                                              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

                                                                  constructor(
                                                                      protected internalRoomAdapter: RocketChatRoomAdapter,
                                                                      protected internalUserAdapter: RocketChatUserAdapter,
                                                                      protected internalMessageAdapter: RocketChatMessageAdapter,
                                                                      protected internalFileAdapter: RocketChatFileAdapter,
                                                              apps/meteor/ee/server/local-services/federation/application/room/sender/RoomServiceSender.ts on lines 26..37

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

                                                              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

                                                                      const {
                                                                          externalRoomId,
                                                                          normalizedInviteeId,
                                                                          normalizedRoomId,
                                                                          normalizedInviterId,
                                                              apps/meteor/client/views/omnichannel/departments/EditDepartment.tsx on lines 138..154

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

                                                              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 (replyToEventId) {
                                                                          const messageToReplyTo = await this.internalMessageAdapter.getMessageByFederationId(replyToEventId);
                                                                          if (!messageToReplyTo) {
                                                                              return;
                                                                          }
                                                              apps/meteor/server/services/federation/application/room/receiver/RoomServiceReceiver.ts on lines 418..433

                                                              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

                                                                      if (replyToEventId) {
                                                                          const messageToReplyTo = await this.internalMessageAdapter.getMessageByFederationId(replyToEventId);
                                                                          if (!messageToReplyTo) {
                                                                              return;
                                                                          }
                                                              apps/meteor/server/services/federation/application/room/receiver/RoomServiceReceiver.ts on lines 537..552

                                                              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

                                                                      const fileDetails = {
                                                                          name: messageBody.filename,
                                                                          size: messageBody.size,
                                                                          type: messageBody.mimetype,
                                                                          rid: federatedRoom.getInternalId(),
                                                              apps/meteor/server/services/federation/application/room/receiver/RoomServiceReceiver.ts on lines 522..528

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

                                                              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

                                                                      const fileDetails = {
                                                                          name: messageBody.filename,
                                                                          size: messageBody.size,
                                                                          type: messageBody.mimetype,
                                                                          rid: federatedRoom.getInternalId(),
                                                              apps/meteor/server/services/federation/application/room/receiver/RoomServiceReceiver.ts on lines 760..766

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

                                                              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 (userProfile?.displayName) {
                                                                          const federatedUser = await this.internalUserAdapter.getFederatedUserByExternalId(externalInviteeId);
                                                                          federatedUser && (await this.updateUserDisplayNameInternally(federatedUser, userProfile?.displayName));
                                                                      }
                                                              apps/meteor/server/services/federation/application/room/receiver/RoomServiceReceiver.ts on lines 83..86

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

                                                              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 (userProfile?.avatarUrl) {
                                                                          const federatedUser = await this.internalUserAdapter.getFederatedUserByExternalId(externalInviteeId);
                                                                          federatedUser && (await this.updateUserAvatarInternally(federatedUser, userProfile?.avatarUrl));
                                                                      }
                                                              apps/meteor/server/services/federation/application/room/receiver/RoomServiceReceiver.ts on lines 87..90

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

                                                              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

                                                                      const { files = [], attachments } = await this.internalFileAdapter.uploadFile(
                                                                          readableStream,
                                                                          federatedRoom.getInternalId(),
                                                                          senderUser.getInternalReference(),
                                                                          fileDetails,
                                                              apps/meteor/server/services/federation/application/room/receiver/RoomServiceReceiver.ts on lines 530..535

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

                                                              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

                                                                      const { files = [], attachments } = await this.internalFileAdapter.uploadFile(
                                                                          readableStream,
                                                                          federatedRoom.getInternalId(),
                                                                          senderUser.getInternalReference(),
                                                                          fileDetails,
                                                              apps/meteor/server/services/federation/application/room/receiver/RoomServiceReceiver.ts on lines 768..773

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

                                                              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

                                                                              return this.internalRoomAdapter.applyRoomRolesToUser({
                                                                                  federatedRoom,
                                                                                  targetFederatedUser,
                                                                                  fromUser: federatedUserWhoChangedThePermission,
                                                                                  rolesToAdd,
                                                              apps/meteor/server/services/federation/application/room/sender/RoomServiceSender.ts on lines 523..530

                                                              Duplicated Code

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

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

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

                                                              Tuning

                                                              This issue has a mass of 45.

                                                              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