api/src/data/logUtils.ts

Summary

Maintainability
F
3 wks
Test Coverage

File logUtils.ts has 1310 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  putCreateLog as putCreateLogC,
  putDeleteLog as putDeleteLogC,
  putUpdateLog as putUpdateLogC
} from 'erxes-api-utils';
Severity: Major
Found in api/src/data/logUtils.ts - About 3 days to fix

    Function gatherDescriptions has 361 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const gatherDescriptions = async (
      params: IDescriptionParams
    ): Promise<IDescriptions> => {
      const { action, type, obj, updatedDocument } = params;
    
    
    Severity: Major
    Found in api/src/data/logUtils.ts - About 1 day to fix

      Function gatherDescriptions has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
      Open

      const gatherDescriptions = async (
        params: IDescriptionParams
      ): Promise<IDescriptions> => {
        const { action, type, obj, updatedDocument } = params;
      
      
      Severity: Minor
      Found in api/src/data/logUtils.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 findContentItemName has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

      const findContentItemName = async (
        contentType: string,
        contentTypeId: string
      ): Promise<string> => {
        let name: string = '';
      Severity: Minor
      Found in api/src/data/logUtils.ts - About 3 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function getDbSchemaLabels has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      export const getDbSchemaLabels = async (type: string) => {
        let fieldNames: INameLabel[] = [];
      
        const found: ISchemaMap | undefined = LOG_MAPPINGS.find(m => m.name === type);
      
      
      Severity: Minor
      Found in api/src/data/logUtils.ts - About 2 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 gatherBoardItemFieldNames has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const gatherBoardItemFieldNames = async (
        doc: BoardItemDocument,
        prevList?: LogDesc[]
      ): Promise<LogDesc[]> => {
        let options: LogDesc[] = [];
      Severity: Major
      Found in api/src/data/logUtils.ts - About 2 hrs to fix

        Function findContentItemName has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const findContentItemName = async (
          contentType: string,
          contentTypeId: string
        ): Promise<string> => {
          let name: string = '';
        Severity: Minor
        Found in api/src/data/logUtils.ts - About 2 hrs to fix

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

          const gatherEngageFieldNames = async (
            doc: IEngageMessageDocument | IEngageMessage,
            prevList?: LogDesc[]
          ): Promise<LogDesc[]> => {
            let options: LogDesc[] = [];
          Severity: Minor
          Found in api/src/data/logUtils.ts - About 1 hr to fix

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

            const gatherPipelineFieldNames = async (
              doc: IPipelineDocument,
              prevList?: LogDesc[]
            ): Promise<LogDesc[]> => {
              let options: LogDesc[] = [];
            Severity: Minor
            Found in api/src/data/logUtils.ts - About 1 hr to fix

              Function gatherCompanyFieldNames has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const gatherCompanyFieldNames = async (
                doc: ICompanyDocument,
                prevList?: LogDesc[]
              ): Promise<LogDesc[]> => {
                let options: LogDesc[] = [];
              Severity: Minor
              Found in api/src/data/logUtils.ts - About 1 hr to fix

                Function gatherNames has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                const gatherNames = async (params: ILogParams): Promise<LogDesc[]> => {
                  const {
                    collection,
                    idFields,
                    foreignKey,
                Severity: Minor
                Found in api/src/data/logUtils.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 gatherCustomerFieldNames has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const gatherCustomerFieldNames = async (
                  doc: ICustomerDocument,
                  prevList?: LogDesc[]
                ): Promise<LogDesc[]> => {
                  let options: LogDesc[] = [];
                Severity: Minor
                Found in api/src/data/logUtils.ts - About 1 hr to fix

                  Function gatherIntegrationFieldNames has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const gatherIntegrationFieldNames = async (
                    doc: IIntegrationDocument,
                    prevList?: LogDesc[]
                  ) => {
                    let options: LogDesc[] = [];
                  Severity: Minor
                  Found in api/src/data/logUtils.ts - About 1 hr to fix

                    Function gatherKbTopicFieldNames has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const gatherKbTopicFieldNames = async (
                      doc: ITopicDocument,
                      prevList?: LogDesc[]
                    ): Promise<LogDesc[]> => {
                      let options: LogDesc[] = [];
                    Severity: Minor
                    Found in api/src/data/logUtils.ts - About 1 hr to fix

                      Function gatherStageFieldNames has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const gatherStageFieldNames = async (
                        doc: IStageDocument,
                        prevList?: LogDesc[]
                      ): Promise<LogDesc[]> => {
                        let options: LogDesc[] = [];
                      Severity: Minor
                      Found in api/src/data/logUtils.ts - About 1 hr to fix

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

                        const gatherScriptFieldNames = async (
                          doc: IScriptDocument,
                          prevList?: LogDesc[]
                        ): Promise<LogDesc[]> => {
                          let options: LogDesc[] = [];
                        Severity: Minor
                        Found in api/src/data/logUtils.ts - About 1 hr to fix

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

                          const gatherChannelFieldNames = async (
                            doc: IChannelDocument,
                            prevList?: LogDesc[]
                          ): Promise<LogDesc[]> => {
                            let options: LogDesc[] = [];
                          Severity: Minor
                          Found in api/src/data/logUtils.ts - About 1 hr to fix

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

                            const gatherBoardItemFieldNames = async (
                              doc: BoardItemDocument,
                              prevList?: LogDesc[]
                            ): Promise<LogDesc[]> => {
                              let options: LogDesc[] = [];
                            Severity: Minor
                            Found in api/src/data/logUtils.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 gatherEngageFieldNames has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const gatherEngageFieldNames = async (
                              doc: IEngageMessageDocument | IEngageMessage,
                              prevList?: LogDesc[]
                            ): Promise<LogDesc[]> => {
                              let options: LogDesc[] = [];
                            Severity: Minor
                            Found in api/src/data/logUtils.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

                            export const putUpdateLog = async (
                              params: ILogDataParams,
                              user: IUserDocument
                            ) => {
                              await sendToWebhook(LOG_ACTIONS.UPDATE, params.type, params);
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 1 other location - About 4 hrs to fix
                            api/src/data/logUtils.ts on lines 1527..1541

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

                            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

                            export const putDeleteLog = async (
                              params: ILogDataParams,
                              user: IUserDocument
                            ) => {
                              await sendToWebhook(LOG_ACTIONS.DELETE, params.type, params);
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 1 other location - About 4 hrs to fix
                            api/src/data/logUtils.ts on lines 1506..1520

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

                            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 gatherIntegrationNames = async (
                              params: ILogNameParams
                            ): Promise<LogDesc[]> => {
                              const { idFields, foreignKey, prevList } = params;
                            
                            
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 1 other location - About 2 hrs to fix
                            api/src/data/logUtils.ts on lines 262..274

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

                            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

                            export const gatherTagNames = async (
                              params: ILogNameParams
                            ): Promise<LogDesc[]> => {
                              const { idFields, foreignKey, prevList } = params;
                            
                            
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 1 other location - About 2 hrs to fix
                            api/src/data/logUtils.ts on lines 248..260

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

                            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 (doc.stages && doc.stages.length > 0) {
                                options = await gatherNames({
                                  collection: Forms,
                                  idFields: doc.stages.map(s => s.formId),
                                  foreignKey: 'formId',
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 1 other location - About 2 hrs to fix
                            api/src/data/logUtils.ts on lines 541..549

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

                              if (doc.productsData && doc.productsData.length > 0) {
                                options = await gatherNames({
                                  collection: Products,
                                  idFields: doc.productsData.map(p => p.productId),
                                  foreignKey: 'productId',
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 1 other location - About 2 hrs to fix
                            api/src/data/logUtils.ts on lines 939..947

                            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

                              if (doc.labelIds && doc.labelIds.length > 0) {
                                options = await gatherNames({
                                  collection: PipelineLabels,
                                  idFields: doc.labelIds,
                                  foreignKey: 'labelIds',
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 2 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 388..396
                            api/src/data/logUtils.ts on lines 564..572

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

                            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

                              if (doc.mergedIds && doc.mergedIds.length > 0) {
                                options = await gatherNames({
                                  collection: Companies,
                                  idFields: doc.mergedIds,
                                  foreignKey: 'mergedIds',
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 2 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 490..498
                            api/src/data/logUtils.ts on lines 564..572

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

                            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

                              if (doc.segmentIds && doc.segmentIds.length > 0) {
                                options = await gatherNames({
                                  collection: Segments,
                                  idFields: doc.segmentIds,
                                  foreignKey: 'segmentIds',
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 2 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 388..396
                            api/src/data/logUtils.ts on lines 490..498

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

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

                                case MODULE_NAMES.CUSTOMER:
                                  description = `"${obj.firstName}" has been ${action}d`;
                            
                                  extraDesc = await gatherCustomerFieldNames(obj);
                            
                            
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 10 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 1129..1137
                            api/src/data/logUtils.ts on lines 1142..1150
                            api/src/data/logUtils.ts on lines 1151..1160
                            api/src/data/logUtils.ts on lines 1203..1215
                            api/src/data/logUtils.ts on lines 1233..1242
                            api/src/data/logUtils.ts on lines 1243..1255
                            api/src/data/logUtils.ts on lines 1332..1341
                            api/src/data/logUtils.ts on lines 1390..1399
                            api/src/data/logUtils.ts on lines 1427..1436
                            api/src/data/logUtils.ts on lines 1437..1446

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

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

                                case MODULE_NAMES.KB_TOPIC:
                                  description = `"${obj.title}" has been ${action}d`;
                            
                                  extraDesc = await gatherKbTopicFieldNames(obj);
                            
                            
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 10 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 1119..1128
                            api/src/data/logUtils.ts on lines 1129..1137
                            api/src/data/logUtils.ts on lines 1142..1150
                            api/src/data/logUtils.ts on lines 1151..1160
                            api/src/data/logUtils.ts on lines 1203..1215
                            api/src/data/logUtils.ts on lines 1243..1255
                            api/src/data/logUtils.ts on lines 1332..1341
                            api/src/data/logUtils.ts on lines 1390..1399
                            api/src/data/logUtils.ts on lines 1427..1436
                            api/src/data/logUtils.ts on lines 1437..1446

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

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

                                case MODULE_NAMES.KB_CATEGORY:
                                  description = `"${obj.title}" has been ${action}d`;
                            
                                  extraDesc = await gatherKbCategoryFieldNames(obj);
                            
                            
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 10 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 1119..1128
                            api/src/data/logUtils.ts on lines 1129..1137
                            api/src/data/logUtils.ts on lines 1142..1150
                            api/src/data/logUtils.ts on lines 1151..1160
                            api/src/data/logUtils.ts on lines 1203..1215
                            api/src/data/logUtils.ts on lines 1233..1242
                            api/src/data/logUtils.ts on lines 1332..1341
                            api/src/data/logUtils.ts on lines 1390..1399
                            api/src/data/logUtils.ts on lines 1427..1436
                            api/src/data/logUtils.ts on lines 1437..1446

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

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

                                case MODULE_NAMES.ENGAGE:
                                  description = `"${obj.title}" has been ${action}d`;
                                  extraDesc = await gatherEngageFieldNames(obj);
                            
                                  if (updatedDocument) {
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 10 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 1119..1128
                            api/src/data/logUtils.ts on lines 1129..1137
                            api/src/data/logUtils.ts on lines 1151..1160
                            api/src/data/logUtils.ts on lines 1203..1215
                            api/src/data/logUtils.ts on lines 1233..1242
                            api/src/data/logUtils.ts on lines 1243..1255
                            api/src/data/logUtils.ts on lines 1332..1341
                            api/src/data/logUtils.ts on lines 1390..1399
                            api/src/data/logUtils.ts on lines 1427..1436
                            api/src/data/logUtils.ts on lines 1437..1446

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

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

                                case MODULE_NAMES.PRODUCT:
                                  description = `${obj.name} has been ${action}d`;
                            
                                  extraDesc = await gatherProductFieldNames(obj);
                            
                            
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 10 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 1119..1128
                            api/src/data/logUtils.ts on lines 1129..1137
                            api/src/data/logUtils.ts on lines 1142..1150
                            api/src/data/logUtils.ts on lines 1151..1160
                            api/src/data/logUtils.ts on lines 1203..1215
                            api/src/data/logUtils.ts on lines 1233..1242
                            api/src/data/logUtils.ts on lines 1243..1255
                            api/src/data/logUtils.ts on lines 1390..1399
                            api/src/data/logUtils.ts on lines 1427..1436
                            api/src/data/logUtils.ts on lines 1437..1446

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

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

                                case MODULE_NAMES.DEAL:
                                  description = `"${obj.name}" has been ${action}d`;
                                  extraDesc = await gatherDealFieldNames(obj);
                            
                                  if (updatedDocument) {
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 10 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 1119..1128
                            api/src/data/logUtils.ts on lines 1142..1150
                            api/src/data/logUtils.ts on lines 1151..1160
                            api/src/data/logUtils.ts on lines 1203..1215
                            api/src/data/logUtils.ts on lines 1233..1242
                            api/src/data/logUtils.ts on lines 1243..1255
                            api/src/data/logUtils.ts on lines 1332..1341
                            api/src/data/logUtils.ts on lines 1390..1399
                            api/src/data/logUtils.ts on lines 1427..1436
                            api/src/data/logUtils.ts on lines 1437..1446

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

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

                                case MODULE_NAMES.SCRIPT:
                                  description = `"${obj.name}" has been ${action}d`;
                            
                                  extraDesc = await gatherScriptFieldNames(obj);
                            
                            
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 10 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 1119..1128
                            api/src/data/logUtils.ts on lines 1129..1137
                            api/src/data/logUtils.ts on lines 1142..1150
                            api/src/data/logUtils.ts on lines 1151..1160
                            api/src/data/logUtils.ts on lines 1203..1215
                            api/src/data/logUtils.ts on lines 1233..1242
                            api/src/data/logUtils.ts on lines 1243..1255
                            api/src/data/logUtils.ts on lines 1332..1341
                            api/src/data/logUtils.ts on lines 1427..1436
                            api/src/data/logUtils.ts on lines 1437..1446

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

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

                                case MODULE_NAMES.GROWTH_HACK:
                                  description = `"${obj.name}" has been ${action}d`;
                            
                                  extraDesc = await gatherGHFieldNames(obj);
                            
                            
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 10 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 1119..1128
                            api/src/data/logUtils.ts on lines 1129..1137
                            api/src/data/logUtils.ts on lines 1142..1150
                            api/src/data/logUtils.ts on lines 1203..1215
                            api/src/data/logUtils.ts on lines 1233..1242
                            api/src/data/logUtils.ts on lines 1243..1255
                            api/src/data/logUtils.ts on lines 1332..1341
                            api/src/data/logUtils.ts on lines 1390..1399
                            api/src/data/logUtils.ts on lines 1427..1436
                            api/src/data/logUtils.ts on lines 1437..1446

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

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

                                case MODULE_NAMES.INTEGRATION:
                                  description = `"${obj.name}" has been ${action}d`;
                            
                                  extraDesc = await gatherIntegrationFieldNames(obj);
                            
                            
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 10 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 1119..1128
                            api/src/data/logUtils.ts on lines 1129..1137
                            api/src/data/logUtils.ts on lines 1142..1150
                            api/src/data/logUtils.ts on lines 1151..1160
                            api/src/data/logUtils.ts on lines 1233..1242
                            api/src/data/logUtils.ts on lines 1243..1255
                            api/src/data/logUtils.ts on lines 1332..1341
                            api/src/data/logUtils.ts on lines 1390..1399
                            api/src/data/logUtils.ts on lines 1427..1436
                            api/src/data/logUtils.ts on lines 1437..1446

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

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

                                case MODULE_NAMES.TASK:
                                  description = `"${obj.name}" has been ${action}d`;
                            
                                  extraDesc = await gatherBoardItemFieldNames(obj);
                            
                            
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 10 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 1119..1128
                            api/src/data/logUtils.ts on lines 1129..1137
                            api/src/data/logUtils.ts on lines 1142..1150
                            api/src/data/logUtils.ts on lines 1151..1160
                            api/src/data/logUtils.ts on lines 1203..1215
                            api/src/data/logUtils.ts on lines 1233..1242
                            api/src/data/logUtils.ts on lines 1243..1255
                            api/src/data/logUtils.ts on lines 1332..1341
                            api/src/data/logUtils.ts on lines 1390..1399
                            api/src/data/logUtils.ts on lines 1437..1446

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

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

                                case MODULE_NAMES.TICKET:
                                  description = `"${obj.name}" has been ${action}d`;
                            
                                  extraDesc = await gatherBoardItemFieldNames(obj);
                            
                            
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 10 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 1119..1128
                            api/src/data/logUtils.ts on lines 1129..1137
                            api/src/data/logUtils.ts on lines 1142..1150
                            api/src/data/logUtils.ts on lines 1151..1160
                            api/src/data/logUtils.ts on lines 1203..1215
                            api/src/data/logUtils.ts on lines 1233..1242
                            api/src/data/logUtils.ts on lines 1243..1255
                            api/src/data/logUtils.ts on lines 1332..1341
                            api/src/data/logUtils.ts on lines 1390..1399
                            api/src/data/logUtils.ts on lines 1427..1436

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

                            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

                                case MODULE_NAMES.CHANNEL:
                                  extraDesc = await gatherChannelFieldNames(obj);
                                  description = `"${obj.name}" has been ${action}d`;
                            
                                  if (updatedDocument) {
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 1 other location - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 1110..1118

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

                            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

                                case MODULE_NAMES.COMPANY:
                                  extraDesc = await gatherCompanyFieldNames(obj);
                                  description = `"${obj.primaryName}" has been ${action}d`;
                            
                                  if (updatedDocument) {
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 1 other location - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 1050..1058

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

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

                              if (doc.memberIds && doc.memberIds.length > 0) {
                                options = await gatherUsernames({
                                  idFields: doc.memberIds,
                                  foreignKey: 'memberIds',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 14 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 398..404
                            api/src/data/logUtils.ts on lines 435..441
                            api/src/data/logUtils.ts on lines 474..480
                            api/src/data/logUtils.ts on lines 482..488
                            api/src/data/logUtils.ts on lines 574..580
                            api/src/data/logUtils.ts on lines 582..588
                            api/src/data/logUtils.ts on lines 627..633
                            api/src/data/logUtils.ts on lines 635..641
                            api/src/data/logUtils.ts on lines 658..664
                            api/src/data/logUtils.ts on lines 695..701
                            api/src/data/logUtils.ts on lines 810..816
                            api/src/data/logUtils.ts on lines 859..865
                            api/src/data/logUtils.ts on lines 896..902
                            api/src/data/logUtils.ts on lines 912..918

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

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

                              if (doc.memberIds && doc.memberIds.length > 0) {
                                options = await gatherUsernames({
                                  idFields: doc.memberIds,
                                  foreignKey: 'memberIds',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 14 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 398..404
                            api/src/data/logUtils.ts on lines 435..441
                            api/src/data/logUtils.ts on lines 474..480
                            api/src/data/logUtils.ts on lines 482..488
                            api/src/data/logUtils.ts on lines 574..580
                            api/src/data/logUtils.ts on lines 582..588
                            api/src/data/logUtils.ts on lines 635..641
                            api/src/data/logUtils.ts on lines 658..664
                            api/src/data/logUtils.ts on lines 695..701
                            api/src/data/logUtils.ts on lines 810..816
                            api/src/data/logUtils.ts on lines 859..865
                            api/src/data/logUtils.ts on lines 896..902
                            api/src/data/logUtils.ts on lines 904..910
                            api/src/data/logUtils.ts on lines 912..918

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

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

                              if (doc.votedUserIds && doc.votedUserIds.length > 0) {
                                options = await gatherUsernames({
                                  idFields: doc.votedUserIds,
                                  foreignKey: 'votedUserIds',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 14 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 398..404
                            api/src/data/logUtils.ts on lines 435..441
                            api/src/data/logUtils.ts on lines 474..480
                            api/src/data/logUtils.ts on lines 482..488
                            api/src/data/logUtils.ts on lines 574..580
                            api/src/data/logUtils.ts on lines 582..588
                            api/src/data/logUtils.ts on lines 627..633
                            api/src/data/logUtils.ts on lines 635..641
                            api/src/data/logUtils.ts on lines 695..701
                            api/src/data/logUtils.ts on lines 810..816
                            api/src/data/logUtils.ts on lines 859..865
                            api/src/data/logUtils.ts on lines 896..902
                            api/src/data/logUtils.ts on lines 904..910
                            api/src/data/logUtils.ts on lines 912..918

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

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

                              if (doc.tagIds && doc.tagIds.length > 0) {
                                options = await gatherTagNames({
                                  idFields: doc.tagIds,
                                  foreignKey: 'tagIds',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 14 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 398..404
                            api/src/data/logUtils.ts on lines 474..480
                            api/src/data/logUtils.ts on lines 482..488
                            api/src/data/logUtils.ts on lines 574..580
                            api/src/data/logUtils.ts on lines 582..588
                            api/src/data/logUtils.ts on lines 627..633
                            api/src/data/logUtils.ts on lines 635..641
                            api/src/data/logUtils.ts on lines 658..664
                            api/src/data/logUtils.ts on lines 695..701
                            api/src/data/logUtils.ts on lines 810..816
                            api/src/data/logUtils.ts on lines 859..865
                            api/src/data/logUtils.ts on lines 896..902
                            api/src/data/logUtils.ts on lines 904..910
                            api/src/data/logUtils.ts on lines 912..918

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

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

                              if (doc.tagIds && doc.tagIds.length > 0) {
                                options = await gatherTagNames({
                                  idFields: doc.tagIds,
                                  foreignKey: 'tagIds',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 14 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 398..404
                            api/src/data/logUtils.ts on lines 435..441
                            api/src/data/logUtils.ts on lines 474..480
                            api/src/data/logUtils.ts on lines 482..488
                            api/src/data/logUtils.ts on lines 574..580
                            api/src/data/logUtils.ts on lines 582..588
                            api/src/data/logUtils.ts on lines 627..633
                            api/src/data/logUtils.ts on lines 635..641
                            api/src/data/logUtils.ts on lines 658..664
                            api/src/data/logUtils.ts on lines 695..701
                            api/src/data/logUtils.ts on lines 859..865
                            api/src/data/logUtils.ts on lines 896..902
                            api/src/data/logUtils.ts on lines 904..910
                            api/src/data/logUtils.ts on lines 912..918

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

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

                              if (doc.brandIds && doc.brandIds.length > 0) {
                                options = await gatherBrandNames({
                                  idFields: doc.brandIds,
                                  foreignKey: 'brandIds',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 14 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 398..404
                            api/src/data/logUtils.ts on lines 435..441
                            api/src/data/logUtils.ts on lines 474..480
                            api/src/data/logUtils.ts on lines 482..488
                            api/src/data/logUtils.ts on lines 582..588
                            api/src/data/logUtils.ts on lines 627..633
                            api/src/data/logUtils.ts on lines 635..641
                            api/src/data/logUtils.ts on lines 658..664
                            api/src/data/logUtils.ts on lines 695..701
                            api/src/data/logUtils.ts on lines 810..816
                            api/src/data/logUtils.ts on lines 859..865
                            api/src/data/logUtils.ts on lines 896..902
                            api/src/data/logUtils.ts on lines 904..910
                            api/src/data/logUtils.ts on lines 912..918

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

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

                              if (doc.watchedUserIds && doc.watchedUserIds.length > 0) {
                                options = await gatherUsernames({
                                  idFields: doc.watchedUserIds,
                                  foreignKey: 'watchedUserIds',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 14 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 398..404
                            api/src/data/logUtils.ts on lines 435..441
                            api/src/data/logUtils.ts on lines 474..480
                            api/src/data/logUtils.ts on lines 574..580
                            api/src/data/logUtils.ts on lines 582..588
                            api/src/data/logUtils.ts on lines 627..633
                            api/src/data/logUtils.ts on lines 635..641
                            api/src/data/logUtils.ts on lines 658..664
                            api/src/data/logUtils.ts on lines 695..701
                            api/src/data/logUtils.ts on lines 810..816
                            api/src/data/logUtils.ts on lines 859..865
                            api/src/data/logUtils.ts on lines 896..902
                            api/src/data/logUtils.ts on lines 904..910
                            api/src/data/logUtils.ts on lines 912..918

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

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

                              if (doc.excludeCheckUserIds && doc.excludeCheckUserIds.length > 0) {
                                options = await gatherUsernames({
                                  idFields: doc.excludeCheckUserIds,
                                  foreignKey: 'excludeCheckUserIds',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 14 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 398..404
                            api/src/data/logUtils.ts on lines 435..441
                            api/src/data/logUtils.ts on lines 474..480
                            api/src/data/logUtils.ts on lines 482..488
                            api/src/data/logUtils.ts on lines 574..580
                            api/src/data/logUtils.ts on lines 582..588
                            api/src/data/logUtils.ts on lines 627..633
                            api/src/data/logUtils.ts on lines 635..641
                            api/src/data/logUtils.ts on lines 658..664
                            api/src/data/logUtils.ts on lines 695..701
                            api/src/data/logUtils.ts on lines 810..816
                            api/src/data/logUtils.ts on lines 859..865
                            api/src/data/logUtils.ts on lines 904..910
                            api/src/data/logUtils.ts on lines 912..918

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

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

                              if (doc.assignedUserIds && doc.assignedUserIds.length > 0) {
                                options = await gatherUsernames({
                                  idFields: doc.assignedUserIds,
                                  foreignKey: 'assignedUserIds',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 14 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 398..404
                            api/src/data/logUtils.ts on lines 435..441
                            api/src/data/logUtils.ts on lines 482..488
                            api/src/data/logUtils.ts on lines 574..580
                            api/src/data/logUtils.ts on lines 582..588
                            api/src/data/logUtils.ts on lines 627..633
                            api/src/data/logUtils.ts on lines 635..641
                            api/src/data/logUtils.ts on lines 658..664
                            api/src/data/logUtils.ts on lines 695..701
                            api/src/data/logUtils.ts on lines 810..816
                            api/src/data/logUtils.ts on lines 859..865
                            api/src/data/logUtils.ts on lines 896..902
                            api/src/data/logUtils.ts on lines 904..910
                            api/src/data/logUtils.ts on lines 912..918

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

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

                              if (doc.leadIds && doc.leadIds.length > 0) {
                                options = await gatherIntegrationNames({
                                  idFields: doc.leadIds,
                                  foreignKey: 'leadIds',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 14 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 398..404
                            api/src/data/logUtils.ts on lines 435..441
                            api/src/data/logUtils.ts on lines 474..480
                            api/src/data/logUtils.ts on lines 482..488
                            api/src/data/logUtils.ts on lines 574..580
                            api/src/data/logUtils.ts on lines 582..588
                            api/src/data/logUtils.ts on lines 627..633
                            api/src/data/logUtils.ts on lines 635..641
                            api/src/data/logUtils.ts on lines 658..664
                            api/src/data/logUtils.ts on lines 695..701
                            api/src/data/logUtils.ts on lines 810..816
                            api/src/data/logUtils.ts on lines 896..902
                            api/src/data/logUtils.ts on lines 904..910
                            api/src/data/logUtils.ts on lines 912..918

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

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

                              if (doc.tagIds && doc.tagIds.length > 0) {
                                options = await gatherTagNames({
                                  idFields: doc.tagIds,
                                  foreignKey: 'tagIds',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 14 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 398..404
                            api/src/data/logUtils.ts on lines 435..441
                            api/src/data/logUtils.ts on lines 474..480
                            api/src/data/logUtils.ts on lines 482..488
                            api/src/data/logUtils.ts on lines 574..580
                            api/src/data/logUtils.ts on lines 627..633
                            api/src/data/logUtils.ts on lines 635..641
                            api/src/data/logUtils.ts on lines 658..664
                            api/src/data/logUtils.ts on lines 695..701
                            api/src/data/logUtils.ts on lines 810..816
                            api/src/data/logUtils.ts on lines 859..865
                            api/src/data/logUtils.ts on lines 896..902
                            api/src/data/logUtils.ts on lines 904..910
                            api/src/data/logUtils.ts on lines 912..918

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

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

                              if (doc.tagIds && doc.tagIds.length > 0) {
                                options = await gatherTagNames({
                                  idFields: doc.tagIds,
                                  foreignKey: 'tagIds',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 14 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 435..441
                            api/src/data/logUtils.ts on lines 474..480
                            api/src/data/logUtils.ts on lines 482..488
                            api/src/data/logUtils.ts on lines 574..580
                            api/src/data/logUtils.ts on lines 582..588
                            api/src/data/logUtils.ts on lines 627..633
                            api/src/data/logUtils.ts on lines 635..641
                            api/src/data/logUtils.ts on lines 658..664
                            api/src/data/logUtils.ts on lines 695..701
                            api/src/data/logUtils.ts on lines 810..816
                            api/src/data/logUtils.ts on lines 859..865
                            api/src/data/logUtils.ts on lines 896..902
                            api/src/data/logUtils.ts on lines 904..910
                            api/src/data/logUtils.ts on lines 912..918

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

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

                              if (doc.integrationIds && doc.integrationIds.length > 0) {
                                options = await gatherIntegrationNames({
                                  idFields: doc.integrationIds,
                                  foreignKey: 'integrationIds',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 14 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 398..404
                            api/src/data/logUtils.ts on lines 435..441
                            api/src/data/logUtils.ts on lines 474..480
                            api/src/data/logUtils.ts on lines 482..488
                            api/src/data/logUtils.ts on lines 574..580
                            api/src/data/logUtils.ts on lines 582..588
                            api/src/data/logUtils.ts on lines 627..633
                            api/src/data/logUtils.ts on lines 658..664
                            api/src/data/logUtils.ts on lines 695..701
                            api/src/data/logUtils.ts on lines 810..816
                            api/src/data/logUtils.ts on lines 859..865
                            api/src/data/logUtils.ts on lines 896..902
                            api/src/data/logUtils.ts on lines 904..910
                            api/src/data/logUtils.ts on lines 912..918

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

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

                              if (doc.tagIds && doc.tagIds.length > 0) {
                                options = await gatherTagNames({
                                  idFields: doc.tagIds,
                                  foreignKey: 'tagIds',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 14 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 398..404
                            api/src/data/logUtils.ts on lines 435..441
                            api/src/data/logUtils.ts on lines 474..480
                            api/src/data/logUtils.ts on lines 482..488
                            api/src/data/logUtils.ts on lines 574..580
                            api/src/data/logUtils.ts on lines 582..588
                            api/src/data/logUtils.ts on lines 627..633
                            api/src/data/logUtils.ts on lines 635..641
                            api/src/data/logUtils.ts on lines 658..664
                            api/src/data/logUtils.ts on lines 810..816
                            api/src/data/logUtils.ts on lines 859..865
                            api/src/data/logUtils.ts on lines 896..902
                            api/src/data/logUtils.ts on lines 904..910
                            api/src/data/logUtils.ts on lines 912..918

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

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

                              if (doc.watchedUserIds && doc.watchedUserIds.length > 0) {
                                options = await gatherUsernames({
                                  idFields: doc.watchedUserIds,
                                  foreignKey: 'watchedUserIds',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 14 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 398..404
                            api/src/data/logUtils.ts on lines 435..441
                            api/src/data/logUtils.ts on lines 474..480
                            api/src/data/logUtils.ts on lines 482..488
                            api/src/data/logUtils.ts on lines 574..580
                            api/src/data/logUtils.ts on lines 582..588
                            api/src/data/logUtils.ts on lines 627..633
                            api/src/data/logUtils.ts on lines 635..641
                            api/src/data/logUtils.ts on lines 658..664
                            api/src/data/logUtils.ts on lines 695..701
                            api/src/data/logUtils.ts on lines 810..816
                            api/src/data/logUtils.ts on lines 859..865
                            api/src/data/logUtils.ts on lines 896..902
                            api/src/data/logUtils.ts on lines 904..910

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

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

                              if (doc.formId) {
                                options = await gatherNames({
                                  collection: Forms,
                                  idFields: [doc.formId],
                                  foreignKey: 'formId',
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 6 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 370..378
                            api/src/data/logUtils.ts on lines 508..516
                            api/src/data/logUtils.ts on lines 703..711
                            api/src/data/logUtils.ts on lines 818..826
                            api/src/data/logUtils.ts on lines 849..857
                            api/src/data/logUtils.ts on lines 991..999

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

                              if (doc.categoryId) {
                                options = await gatherNames({
                                  collection: ProductCategories,
                                  idFields: [doc.categoryId],
                                  foreignKey: 'categoryId',
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 6 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 370..378
                            api/src/data/logUtils.ts on lines 508..516
                            api/src/data/logUtils.ts on lines 703..711
                            api/src/data/logUtils.ts on lines 849..857
                            api/src/data/logUtils.ts on lines 991..999
                            api/src/data/logUtils.ts on lines 1000..1008

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

                              if (doc.kbTopicId) {
                                options = await gatherNames({
                                  collection: KnowledgeBaseTopics,
                                  idFields: [doc.kbTopicId],
                                  foreignKey: 'kbTopicId',
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 6 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 370..378
                            api/src/data/logUtils.ts on lines 508..516
                            api/src/data/logUtils.ts on lines 703..711
                            api/src/data/logUtils.ts on lines 818..826
                            api/src/data/logUtils.ts on lines 991..999
                            api/src/data/logUtils.ts on lines 1000..1008

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

                              if (doc.parentCompanyId) {
                                options = await gatherNames({
                                  collection: Companies,
                                  idFields: [doc.parentCompanyId],
                                  foreignKey: 'parentCompanyId',
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 6 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 508..516
                            api/src/data/logUtils.ts on lines 703..711
                            api/src/data/logUtils.ts on lines 818..826
                            api/src/data/logUtils.ts on lines 849..857
                            api/src/data/logUtils.ts on lines 991..999
                            api/src/data/logUtils.ts on lines 1000..1008

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

                              if (doc.pipelineId) {
                                options = await gatherNames({
                                  collection: Pipelines,
                                  idFields: [doc.pipelineId],
                                  foreignKey: 'pipelineId',
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 6 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 370..378
                            api/src/data/logUtils.ts on lines 508..516
                            api/src/data/logUtils.ts on lines 703..711
                            api/src/data/logUtils.ts on lines 818..826
                            api/src/data/logUtils.ts on lines 849..857
                            api/src/data/logUtils.ts on lines 1000..1008

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

                              if (doc.initialStageId) {
                                options = await gatherNames({
                                  collection: Stages,
                                  idFields: [doc.initialStageId],
                                  foreignKey: 'initialStageId',
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 6 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 370..378
                            api/src/data/logUtils.ts on lines 703..711
                            api/src/data/logUtils.ts on lines 818..826
                            api/src/data/logUtils.ts on lines 849..857
                            api/src/data/logUtils.ts on lines 991..999
                            api/src/data/logUtils.ts on lines 1000..1008

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

                              if (doc.formId) {
                                options = await gatherNames({
                                  collection: Forms,
                                  idFields: [doc.formId],
                                  foreignKey: 'formId',
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 6 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 370..378
                            api/src/data/logUtils.ts on lines 508..516
                            api/src/data/logUtils.ts on lines 818..826
                            api/src/data/logUtils.ts on lines 849..857
                            api/src/data/logUtils.ts on lines 991..999
                            api/src/data/logUtils.ts on lines 1000..1008

                            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 (contentType === MODULE_NAMES.DEAL) {
                                const deal = await Deals.getDeal(contentTypeId);
                            
                                if (deal && deal.name) {
                                  name = deal.name;
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 3 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 197..203
                            api/src/data/logUtils.ts on lines 204..210
                            api/src/data/logUtils.ts on lines 211..217

                            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 (contentType === MODULE_NAMES.TASK) {
                                const task = await Tasks.getTask(contentTypeId);
                            
                                if (task && task.name) {
                                  name = task.name;
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 3 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 176..182
                            api/src/data/logUtils.ts on lines 204..210
                            api/src/data/logUtils.ts on lines 211..217

                            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 (contentType === MODULE_NAMES.GROWTH_HACK) {
                                const gh = await GrowthHacks.getGrowthHack(contentTypeId);
                            
                                if (gh && gh.name) {
                                  name = gh.name;
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 3 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 176..182
                            api/src/data/logUtils.ts on lines 197..203
                            api/src/data/logUtils.ts on lines 204..210

                            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 (contentType === MODULE_NAMES.TICKET) {
                                const ticket = await Tickets.getTicket(contentTypeId);
                            
                                if (ticket && ticket.name) {
                                  name = ticket.name;
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 3 other locations - About 1 hr to fix
                            api/src/data/logUtils.ts on lines 176..182
                            api/src/data/logUtils.ts on lines 197..203
                            api/src/data/logUtils.ts on lines 211..217

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

                                  if (action === LOG_ACTIONS.DELETE) {
                                    description = `"${
                                      obj.title
                                    }" from ${obj.contentType.toUpperCase()} "${itemName}" has been removed`;
                                  }
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 2 other locations - About 55 mins to fix
                            api/src/data/logUtils.ts on lines 1072..1076
                            api/src/data/logUtils.ts on lines 1077..1081

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

                                  if (action === LOG_ACTIONS.UPDATE) {
                                    description = `"${
                                      obj.title
                                    }" saved in ${obj.contentType.toUpperCase()} "${itemName}" has been edited`;
                                  }
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 2 other locations - About 55 mins to fix
                            api/src/data/logUtils.ts on lines 1072..1076
                            api/src/data/logUtils.ts on lines 1082..1086

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

                                  if (action === LOG_ACTIONS.CREATE) {
                                    description = `"${
                                      obj.title
                                    }" has been created in ${obj.contentType.toUpperCase()} "${itemName}"`;
                                  }
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 2 other locations - About 55 mins to fix
                            api/src/data/logUtils.ts on lines 1077..1081
                            api/src/data/logUtils.ts on lines 1082..1086

                            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 (contentType === MODULE_NAMES.CUSTOMER) {
                                const customer = await Customers.getCustomer(contentTypeId);
                            
                                if (customer) {
                                  name = Customers.getCustomerName(customer);
                            Severity: Minor
                            Found in api/src/data/logUtils.ts and 1 other location - About 55 mins to fix
                            api/src/data/logUtils.ts on lines 190..196

                            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 (contentType === MODULE_NAMES.COMPANY) {
                                const company = await Companies.getCompany(contentTypeId);
                            
                                if (company) {
                                  name = Companies.getCompanyName(company);
                            Severity: Minor
                            Found in api/src/data/logUtils.ts and 1 other location - About 55 mins to fix
                            api/src/data/logUtils.ts on lines 183..189

                            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 (parentIds.length > 0) {
                                    extraDesc = await gatherNames({
                                      collection: ProductCategories,
                                      idFields: parentIds,
                                      foreignKey: 'parentId',
                            Severity: Minor
                            Found in api/src/data/logUtils.ts and 1 other location - About 50 mins to fix
                            api/src/data/logUtils.ts on lines 1415..1422

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

                                  if (parents.length > 0) {
                                    extraDesc = await gatherNames({
                                      collection: Segments,
                                      idFields: parents,
                                      foreignKey: 'subOf',
                            Severity: Minor
                            Found in api/src/data/logUtils.ts and 1 other location - About 50 mins to fix
                            api/src/data/logUtils.ts on lines 1355..1362

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

                              if (doc.userId) {
                                options = await gatherUsernames({
                                  idFields: [doc.userId],
                                  foreignKey: 'userId',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 13 other locations - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 380..386
                            api/src/data/logUtils.ts on lines 419..425
                            api/src/data/logUtils.ts on lines 427..433
                            api/src/data/logUtils.ts on lines 518..524
                            api/src/data/logUtils.ts on lines 590..596
                            api/src/data/logUtils.ts on lines 619..625
                            api/src/data/logUtils.ts on lines 679..685
                            api/src/data/logUtils.ts on lines 687..693
                            api/src/data/logUtils.ts on lines 738..744
                            api/src/data/logUtils.ts on lines 841..847
                            api/src/data/logUtils.ts on lines 888..894
                            api/src/data/logUtils.ts on lines 984..990
                            api/src/data/logUtils.ts on lines 1264..1270

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

                              if (doc.fromUserId) {
                                options = await gatherUsernames({
                                  idFields: [doc.fromUserId],
                                  foreignKey: 'fromUserId',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 13 other locations - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 380..386
                            api/src/data/logUtils.ts on lines 419..425
                            api/src/data/logUtils.ts on lines 427..433
                            api/src/data/logUtils.ts on lines 466..472
                            api/src/data/logUtils.ts on lines 518..524
                            api/src/data/logUtils.ts on lines 619..625
                            api/src/data/logUtils.ts on lines 679..685
                            api/src/data/logUtils.ts on lines 687..693
                            api/src/data/logUtils.ts on lines 738..744
                            api/src/data/logUtils.ts on lines 841..847
                            api/src/data/logUtils.ts on lines 888..894
                            api/src/data/logUtils.ts on lines 984..990
                            api/src/data/logUtils.ts on lines 1264..1270

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

                              if (doc.brandId) {
                                options = await gatherBrandNames({
                                  idFields: [doc.brandId],
                                  foreignKey: 'brandId',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 13 other locations - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 380..386
                            api/src/data/logUtils.ts on lines 419..425
                            api/src/data/logUtils.ts on lines 427..433
                            api/src/data/logUtils.ts on lines 466..472
                            api/src/data/logUtils.ts on lines 518..524
                            api/src/data/logUtils.ts on lines 590..596
                            api/src/data/logUtils.ts on lines 619..625
                            api/src/data/logUtils.ts on lines 679..685
                            api/src/data/logUtils.ts on lines 687..693
                            api/src/data/logUtils.ts on lines 841..847
                            api/src/data/logUtils.ts on lines 888..894
                            api/src/data/logUtils.ts on lines 984..990
                            api/src/data/logUtils.ts on lines 1264..1270

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

                              if (doc.integrationId) {
                                options = await gatherIntegrationNames({
                                  idFields: [doc.integrationId],
                                  foreignKey: 'integrationId',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 13 other locations - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 380..386
                            api/src/data/logUtils.ts on lines 419..425
                            api/src/data/logUtils.ts on lines 466..472
                            api/src/data/logUtils.ts on lines 518..524
                            api/src/data/logUtils.ts on lines 590..596
                            api/src/data/logUtils.ts on lines 619..625
                            api/src/data/logUtils.ts on lines 679..685
                            api/src/data/logUtils.ts on lines 687..693
                            api/src/data/logUtils.ts on lines 738..744
                            api/src/data/logUtils.ts on lines 841..847
                            api/src/data/logUtils.ts on lines 888..894
                            api/src/data/logUtils.ts on lines 984..990
                            api/src/data/logUtils.ts on lines 1264..1270

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

                              if (doc.brandId) {
                                options = await gatherBrandNames({
                                  idFields: [doc.brandId],
                                  foreignKey: 'brandId',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 13 other locations - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 380..386
                            api/src/data/logUtils.ts on lines 419..425
                            api/src/data/logUtils.ts on lines 427..433
                            api/src/data/logUtils.ts on lines 466..472
                            api/src/data/logUtils.ts on lines 518..524
                            api/src/data/logUtils.ts on lines 590..596
                            api/src/data/logUtils.ts on lines 619..625
                            api/src/data/logUtils.ts on lines 679..685
                            api/src/data/logUtils.ts on lines 738..744
                            api/src/data/logUtils.ts on lines 841..847
                            api/src/data/logUtils.ts on lines 888..894
                            api/src/data/logUtils.ts on lines 984..990
                            api/src/data/logUtils.ts on lines 1264..1270

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

                              if (doc.userId) {
                                options = await gatherUsernames({
                                  idFields: [doc.userId],
                                  foreignKey: 'userId',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 13 other locations - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 380..386
                            api/src/data/logUtils.ts on lines 419..425
                            api/src/data/logUtils.ts on lines 427..433
                            api/src/data/logUtils.ts on lines 466..472
                            api/src/data/logUtils.ts on lines 518..524
                            api/src/data/logUtils.ts on lines 590..596
                            api/src/data/logUtils.ts on lines 619..625
                            api/src/data/logUtils.ts on lines 679..685
                            api/src/data/logUtils.ts on lines 687..693
                            api/src/data/logUtils.ts on lines 738..744
                            api/src/data/logUtils.ts on lines 841..847
                            api/src/data/logUtils.ts on lines 984..990
                            api/src/data/logUtils.ts on lines 1264..1270

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

                              if (doc.userId) {
                                options = await gatherUsernames({
                                  idFields: [doc.userId],
                                  foreignKey: 'userId',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 13 other locations - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 380..386
                            api/src/data/logUtils.ts on lines 419..425
                            api/src/data/logUtils.ts on lines 427..433
                            api/src/data/logUtils.ts on lines 466..472
                            api/src/data/logUtils.ts on lines 518..524
                            api/src/data/logUtils.ts on lines 590..596
                            api/src/data/logUtils.ts on lines 619..625
                            api/src/data/logUtils.ts on lines 679..685
                            api/src/data/logUtils.ts on lines 687..693
                            api/src/data/logUtils.ts on lines 738..744
                            api/src/data/logUtils.ts on lines 841..847
                            api/src/data/logUtils.ts on lines 888..894
                            api/src/data/logUtils.ts on lines 1264..1270

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

                              if (doc.modifiedBy) {
                                options = await gatherUsernames({
                                  idFields: [doc.modifiedBy],
                                  foreignKey: 'modifiedBy',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 13 other locations - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 380..386
                            api/src/data/logUtils.ts on lines 419..425
                            api/src/data/logUtils.ts on lines 427..433
                            api/src/data/logUtils.ts on lines 466..472
                            api/src/data/logUtils.ts on lines 590..596
                            api/src/data/logUtils.ts on lines 619..625
                            api/src/data/logUtils.ts on lines 679..685
                            api/src/data/logUtils.ts on lines 687..693
                            api/src/data/logUtils.ts on lines 738..744
                            api/src/data/logUtils.ts on lines 841..847
                            api/src/data/logUtils.ts on lines 888..894
                            api/src/data/logUtils.ts on lines 984..990
                            api/src/data/logUtils.ts on lines 1264..1270

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

                              if (doc.userId) {
                                options = await gatherUsernames({
                                  idFields: [doc.userId],
                                  foreignKey: 'userId',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 13 other locations - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 380..386
                            api/src/data/logUtils.ts on lines 419..425
                            api/src/data/logUtils.ts on lines 427..433
                            api/src/data/logUtils.ts on lines 466..472
                            api/src/data/logUtils.ts on lines 518..524
                            api/src/data/logUtils.ts on lines 590..596
                            api/src/data/logUtils.ts on lines 679..685
                            api/src/data/logUtils.ts on lines 687..693
                            api/src/data/logUtils.ts on lines 738..744
                            api/src/data/logUtils.ts on lines 841..847
                            api/src/data/logUtils.ts on lines 888..894
                            api/src/data/logUtils.ts on lines 984..990
                            api/src/data/logUtils.ts on lines 1264..1270

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

                                  if (obj.modifiedBy) {
                                    extraDesc = await gatherUsernames({
                                      idFields: [obj.modifiedBy],
                                      foreignKey: 'modifiedBy',
                                      prevList: extraDesc
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 13 other locations - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 380..386
                            api/src/data/logUtils.ts on lines 419..425
                            api/src/data/logUtils.ts on lines 427..433
                            api/src/data/logUtils.ts on lines 466..472
                            api/src/data/logUtils.ts on lines 518..524
                            api/src/data/logUtils.ts on lines 590..596
                            api/src/data/logUtils.ts on lines 619..625
                            api/src/data/logUtils.ts on lines 679..685
                            api/src/data/logUtils.ts on lines 687..693
                            api/src/data/logUtils.ts on lines 738..744
                            api/src/data/logUtils.ts on lines 841..847
                            api/src/data/logUtils.ts on lines 888..894
                            api/src/data/logUtils.ts on lines 984..990

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

                              if (doc.ownerId) {
                                options = await gatherUsernames({
                                  idFields: [doc.ownerId],
                                  foreignKey: 'ownerId',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 13 other locations - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 380..386
                            api/src/data/logUtils.ts on lines 427..433
                            api/src/data/logUtils.ts on lines 466..472
                            api/src/data/logUtils.ts on lines 518..524
                            api/src/data/logUtils.ts on lines 590..596
                            api/src/data/logUtils.ts on lines 619..625
                            api/src/data/logUtils.ts on lines 679..685
                            api/src/data/logUtils.ts on lines 687..693
                            api/src/data/logUtils.ts on lines 738..744
                            api/src/data/logUtils.ts on lines 841..847
                            api/src/data/logUtils.ts on lines 888..894
                            api/src/data/logUtils.ts on lines 984..990
                            api/src/data/logUtils.ts on lines 1264..1270

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

                              if (doc.createdUserId) {
                                options = await gatherUsernames({
                                  idFields: [doc.createdUserId],
                                  foreignKey: 'createdUserId',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 13 other locations - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 380..386
                            api/src/data/logUtils.ts on lines 419..425
                            api/src/data/logUtils.ts on lines 427..433
                            api/src/data/logUtils.ts on lines 466..472
                            api/src/data/logUtils.ts on lines 518..524
                            api/src/data/logUtils.ts on lines 590..596
                            api/src/data/logUtils.ts on lines 619..625
                            api/src/data/logUtils.ts on lines 687..693
                            api/src/data/logUtils.ts on lines 738..744
                            api/src/data/logUtils.ts on lines 841..847
                            api/src/data/logUtils.ts on lines 888..894
                            api/src/data/logUtils.ts on lines 984..990
                            api/src/data/logUtils.ts on lines 1264..1270

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

                              if (doc.messengerId) {
                                options = await gatherIntegrationNames({
                                  idFields: [doc.messengerId],
                                  foreignKey: 'messengerId',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 13 other locations - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 380..386
                            api/src/data/logUtils.ts on lines 419..425
                            api/src/data/logUtils.ts on lines 427..433
                            api/src/data/logUtils.ts on lines 466..472
                            api/src/data/logUtils.ts on lines 518..524
                            api/src/data/logUtils.ts on lines 590..596
                            api/src/data/logUtils.ts on lines 619..625
                            api/src/data/logUtils.ts on lines 679..685
                            api/src/data/logUtils.ts on lines 687..693
                            api/src/data/logUtils.ts on lines 738..744
                            api/src/data/logUtils.ts on lines 888..894
                            api/src/data/logUtils.ts on lines 984..990
                            api/src/data/logUtils.ts on lines 1264..1270

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

                              if (doc.ownerId) {
                                options = await gatherUsernames({
                                  idFields: [doc.ownerId],
                                  foreignKey: 'ownerId',
                                  prevList: options
                            Severity: Major
                            Found in api/src/data/logUtils.ts and 13 other locations - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 419..425
                            api/src/data/logUtils.ts on lines 427..433
                            api/src/data/logUtils.ts on lines 466..472
                            api/src/data/logUtils.ts on lines 518..524
                            api/src/data/logUtils.ts on lines 590..596
                            api/src/data/logUtils.ts on lines 619..625
                            api/src/data/logUtils.ts on lines 679..685
                            api/src/data/logUtils.ts on lines 687..693
                            api/src/data/logUtils.ts on lines 738..744
                            api/src/data/logUtils.ts on lines 841..847
                            api/src/data/logUtils.ts on lines 888..894
                            api/src/data/logUtils.ts on lines 984..990
                            api/src/data/logUtils.ts on lines 1264..1270

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

                                  if (
                                    updatedDocument &&
                                    updatedDocument.subOf &&
                                    updatedDocument.subOf !== obj.subOf
                                  ) {
                            Severity: Minor
                            Found in api/src/data/logUtils.ts and 1 other location - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 1374..1380

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

                                  if (
                                    updatedDocument &&
                                    updatedDocument.brandId &&
                                    updatedDocument.brandId !== obj.brandId
                                  ) {
                            Severity: Minor
                            Found in api/src/data/logUtils.ts and 1 other location - About 35 mins to fix
                            api/src/data/logUtils.ts on lines 1407..1413

                            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

                            There are no issues that match your filters.

                            Category
                            Status