RocketChat/Rocket.Chat

View on GitHub
apps/meteor/ee/server/models/raw/LivechatRooms.ts

Summary

Maintainability
F
5 days
Test Coverage

File LivechatRooms.ts has 692 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import type {
    ILivechatPriority,
    IOmnichannelRoom,
    IOmnichannelServiceLevelAgreements,
    RocketChatRecordDeleted,
Severity: Major
Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts - About 1 day to fix

    Function getConversationsByStatus has 104 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        getConversationsByStatus(start: Date, end: Date, extraQuery: Filter<IOmnichannelRoom>): AggregationCursor<ReportResult> {
            return this.col.aggregate(
                [
                    {
                        $match: {
    Severity: Major
    Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts - About 4 hrs to fix

      LivechatRoomsRawEE has 30 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoomsModel {
          constructor(db: Db, trash?: Collection<RocketChatRecordDeleted<IOmnichannelRoom>>) {
              super(db, trash);
          }
      
      
      Severity: Minor
      Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts - About 3 hrs to fix

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

            getConversationsByDepartment(
                start: Date,
                end: Date,
                sort: Record<string, 1 | -1>,
                extraQuery: Filter<IOmnichannelRoom>,
        Severity: Major
        Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts - About 2 hrs to fix

          Function getConversationsByAgents has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getConversationsByAgents(
                  start: Date,
                  end: Date,
                  sort: Record<string, 1 | -1>,
                  extraQuery: Filter<IOmnichannelRoom>,
          Severity: Major
          Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts - About 2 hrs to fix

            Function getConversationsByTags has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                getConversationsByTags(
                    start: Date,
                    end: Date,
                    sort: Record<string, 1 | -1>,
                    extraQuery: Filter<IOmnichannelRoom>,
            Severity: Major
            Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts - About 2 hrs to fix

              Function getConversationsBySource has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  getConversationsBySource(start: Date, end: Date, extraQuery: Filter<IOmnichannelRoom>): AggregationCursor<ReportResult> {
                      return this.col.aggregate(
                          [
                              {
                                  $match: {
              Severity: Minor
              Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                Function associateRoomsWithDepartmentToUnit has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    async associateRoomsWithDepartmentToUnit(departments: string[], unitId: string): Promise<void> {
                        const query = {
                            $and: [
                                {
                                    departmentId: { $in: departments },
                Severity: Minor
                Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts - About 1 hr to fix

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

                          getConversationsByDepartment(
                              start: Date,
                              end: Date,
                              sort: Record<string, 1 | -1>,
                              extraQuery: Filter<IOmnichannelRoom>,
                  Severity: Major
                  Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts and 2 other locations - About 1 hr to fix
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 54..59
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 60..65

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

                  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

                          getConversationsByTags(
                              start: Date,
                              end: Date,
                              sort: Record<string, 1 | -1>,
                              extraQuery: Filter<IOmnichannelRoom>,
                  Severity: Major
                  Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts and 2 other locations - About 1 hr to fix
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 48..53
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 60..65

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

                  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

                          getConversationsByAgents(
                              start: Date,
                              end: Date,
                              sort: Record<string, 1 | -1>,
                              extraQuery: Filter<IOmnichannelRoom>,
                  Severity: Major
                  Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts and 2 other locations - About 1 hr to fix
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 48..53
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 54..59

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

                  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

                      async setPriorityByRoomId(roomId: string, priority: Pick<ILivechatPriority, '_id' | 'sortItem'>): Promise<UpdateResult> {
                          const { _id: priorityId, sortItem: priorityWeight } = priority;
                  
                          return this.updateOne({ _id: roomId }, { $set: { priorityId, priorityWeight } });
                      }
                  Severity: Major
                  Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts and 2 other locations - About 1 hr to fix
                  apps/meteor/ee/server/models/raw/LivechatInquiry.ts on lines 20..32
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 128..145

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

                  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

                      setSlaForRoomById(
                          roomId: string,
                          sla: Pick<IOmnichannelServiceLevelAgreements, '_id' | 'dueTimeInMinutes'>,
                      ): Promise<UpdateResult | Document> {
                          const { _id: slaId, dueTimeInMinutes } = sla;
                  Severity: Major
                  Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts and 2 other locations - About 1 hr to fix
                  apps/meteor/ee/server/models/raw/LivechatInquiry.ts on lines 20..32
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 194..198

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

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

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

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

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

                  Refactorings

                  Further Reading

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

                      unsetOnHoldByRoomId(roomId: string): Promise<UpdateResult> {
                          return this.updateOne({ _id: roomId }, { $unset: { onHold: 1 } });
                      }
                  Severity: Major
                  Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts and 5 other locations - About 1 hr to fix
                  apps/meteor/server/models/raw/LivechatVisitors.ts on lines 358..360
                  apps/meteor/server/models/raw/Messages.ts on lines 675..677
                  apps/meteor/server/models/raw/Messages.ts on lines 1563..1574
                  apps/meteor/server/models/raw/NotificationQueue.ts on lines 22..31
                  apps/meteor/server/models/raw/Subscriptions.ts on lines 603..605

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 55.

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

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

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

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

                  Refactorings

                  Further Reading

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

                      setOnHoldByRoomId(roomId: string): Promise<UpdateResult> {
                          return this.updateOne({ _id: roomId }, { $set: { onHold: true } });
                      }
                  Severity: Major
                  Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts and 1 other location - About 1 hr to fix
                  apps/meteor/server/models/raw/Subscriptions.ts on lines 599..601

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 55.

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

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

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

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

                  Refactorings

                  Further Reading

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

                      setPredictedVisitorAbandonmentByRoomId(rid: string, willBeAbandonedAt: Date): Promise<UpdateResult> {
                          const query = {
                              _id: rid,
                          };
                          const update = {
                  Severity: Minor
                  Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts and 1 other location - About 40 mins to fix
                  apps/meteor/server/models/raw/LivechatRooms.ts on lines 2384..2395

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

                  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

                          findOpenBySlaId(
                              slaId: string,
                              options: FindOptions<IOmnichannelRoom>,
                              extraQuery?: Filter<IOmnichannelRoom>,
                          ): FindCursor<IOmnichannelRoom>;
                  Severity: Minor
                  Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts and 1 other location - About 35 mins to fix
                  packages/model-typings/src/models/ILivechatRoomsModel.ts on lines 176..180

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

                  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

                                  {
                                      $group: {
                                          _id: null,
                                          total: { $sum: '$total' },
                                          data: {
                  Severity: Minor
                  Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts and 2 other locations - About 35 mins to fix
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 521..532
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 599..610

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 46.

                  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

                                  {
                                      $group: {
                                          _id: null,
                                          total: { $sum: '$total' },
                                          data: {
                  Severity: Minor
                  Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts and 2 other locations - About 35 mins to fix
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 599..610
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 694..705

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

                  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

                                  {
                                      $group: {
                                          _id: null,
                                          total: { $sum: '$total' },
                                          data: {
                  Severity: Minor
                  Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts and 2 other locations - About 35 mins to fix
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 521..532
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 694..705

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

                  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

                      countRoomsWithSla(): Promise<number> {
                          return this.col.countDocuments({ slaId: { $exists: true } });
                      }
                  Severity: Major
                  Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts and 3 other locations - About 30 mins to fix
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 77..79
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 89..91
                  apps/meteor/server/models/raw/Rooms.ts on lines 1949..1951

                  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

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

                      countRoomsWithTranscriptSent(): Promise<number> {
                          return this.col.countDocuments({ pdfTranscriptFileId: { $exists: true } });
                      }
                  Severity: Major
                  Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts and 3 other locations - About 30 mins to fix
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 77..79
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 81..83
                  apps/meteor/server/models/raw/Rooms.ts on lines 1949..1951

                  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

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

                      countPrioritizedRooms(): Promise<number> {
                          return this.col.countDocuments({ priorityId: { $exists: true } });
                      }
                  Severity: Major
                  Found in apps/meteor/ee/server/models/raw/LivechatRooms.ts and 3 other locations - About 30 mins to fix
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 81..83
                  apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 89..91
                  apps/meteor/server/models/raw/Rooms.ts on lines 1949..1951

                  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