BookBrainz/bookbrainz-site

View on GitHub
src/server/routes/entity/entity.tsx

Summary

Maintainability
F
3 days
Test Coverage

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

export async function processMergeOperation(orm, transacting, session, mainEntity, allEntities, relationshipSets) {
    const {Edition, bookshelf} = orm;
    const {mergingEntities} = session.mergeQueue;
    if (!mergingEntities) {
        throw new Error('Merge handler called with no merge queue, aborting');
Severity: Minor
Found in src/server/routes/entity/entity.tsx - 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 processSingleEntity has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export async function processSingleEntity(formBody, JSONEntity, reqSession,
    entityType, orm:any, editorJSON, derivedProps, isMergeOperation, transacting):Promise<any> {
    const {Entity, Revision} = orm;
    let body = sanitizeBody(formBody);
    let currentEntity: {
Severity: Minor
Found in src/server/routes/entity/entity.tsx - 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 processEditionSets has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

async function processEditionSets(
    orm: any,
    currentEntity: Record<string, unknown> | null | undefined,
    body: ProcessEditionSetsBody,
    transacting: Transaction
Severity: Minor
Found in src/server/routes/entity/entity.tsx - 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 processSingleEntity has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

export async function processSingleEntity(formBody, JSONEntity, reqSession,
    entityType, orm:any, editorJSON, derivedProps, isMergeOperation, transacting):Promise<any> {
Severity: Major
Found in src/server/routes/entity/entity.tsx - About 1 hr to fix

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

    export function displayEntity(req: PassportRequest, res: $Response) {
        const {orm}: {orm?: any} = req.app.locals;
        const {AchievementUnlock, EditorEntityVisits} = orm;
        const {locals: resLocals}: {locals: any} = res;
        const {entity}: {entity: any} = resLocals;
    Severity: Minor
    Found in src/server/routes/entity/entity.tsx - 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 getChangedProps has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        orm, transacting, isNew, currentEntity, body, entityType,
        newRevision, derivedProps
    Severity: Major
    Found in src/server/routes/entity/entity.tsx - About 1 hr to fix

      Function saveEntitiesAndFinishRevision has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          orm, transacting, isNew: boolean, newRevision: any, mainEntity: any,
          updatedEntities: any[], editorID: number, note: string
      Severity: Major
      Found in src/server/routes/entity/entity.tsx - About 1 hr to fix

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

        export function getDefaultAliasIndex(aliasSet) {
            if (_.isNil(aliasSet)) {
                return null;
            }
            const {aliases, defaultAliasId} = aliasSet;
        Severity: Minor
        Found in src/server/routes/entity/entity.tsx - About 55 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

        export async function deleteRelationships(orm: any, transacting: Transaction, mainEntity: any) {
            const mainBBID = mainEntity.bbid;
            const {relationshipSet} = mainEntity;
            const otherBBIDs = [];
            const otherEntities = [];
        Severity: Minor
        Found in src/server/routes/entity/entity.tsx - About 45 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

        Function processMergeOperation has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        export async function processMergeOperation(orm, transacting, session, mainEntity, allEntities, relationshipSets) {
        Severity: Minor
        Found in src/server/routes/entity/entity.tsx - About 45 mins to fix

          Function getNextAnnotation has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              orm, transacting, currentEntity, body, revision
          Severity: Minor
          Found in src/server/routes/entity/entity.tsx - About 35 mins to fix

            Function handleDelete has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                orm: any, req: PassportRequest, res: $Response, HeaderModel: any,
                RevisionModel: any
            Severity: Minor
            Found in src/server/routes/entity/entity.tsx - About 35 mins to fix

              Function processEntitySets has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  orm: any,
                  currentEntity: Record<string, unknown> | null | undefined,
                  entityType: EntityTypeString,
                  body: any,
                  transacting: Transaction
              Severity: Minor
              Found in src/server/routes/entity/entity.tsx - About 35 mins to fix

                Function _createNote has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function _createNote(orm, content, editorID, revision, transacting) {
                Severity: Minor
                Found in src/server/routes/entity/entity.tsx - About 35 mins to fix

                  Function handleCreateOrEditEntity has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      req: PassportRequest,
                      res: $Response,
                      entityType: EntityTypeString,
                      derivedProps: Record<string, unknown>,
                      isMergeOperation: boolean
                  Severity: Minor
                  Found in src/server/routes/entity/entity.tsx - About 35 mins to fix

                    Function fetchOrCreateMainEntity has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        orm, transacting, isNew, bbid, entityType
                    Severity: Minor
                    Found in src/server/routes/entity/entity.tsx - About 35 mins to fix

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

                          const newPublisherSetIDPromise = orm.func.publisher.updatePublisherSet(
                              orm, transacting, oldPublisherSet,
                              publishers.map((publisherBBID) => ({bbid: publisherBBID}))
                          )
                              .then((set) => set && set.get('id'));
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 1 other location - About 1 hr to fix
                      src/server/routes/entity/entity.tsx on lines 748..752

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

                      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 newLanguageSetIDPromise = orm.func.language.updateLanguageSet(
                              orm, transacting, oldLanguageSet,
                              languages.map((languageID) => ({id: languageID}))
                          )
                              .then((set) => set && set.get('id'));
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 1 other location - About 1 hr to fix
                      src/server/routes/entity/entity.tsx on lines 763..767

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

                      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

                              const markup = ReactDOMServer.renderToString(
                                  <Layout {...propHelpers.extractLayoutProps(props)}>
                                      <EntityRevisions
                                          entity={props.entity}
                                          {...propHelpers.extractChildProps(props)}
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 3 other locations - About 1 hr to fix
                      src/server/routes/adminPanel.tsx on lines 84..91
                      src/server/routes/type-editor/identifier-type.tsx on lines 78..85
                      src/server/routes/type-editor/relationship-type.tsx on lines 83..90

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 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

                                  if (relationship.sourceBbid === mainBBID) {
                                      otherBBIDs.push(relationship.targetBbid);
                                  }
                                  else if (relationship.targetBbid === mainBBID) {
                                      otherBBIDs.push(relationship.sourceBbid);
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 1 other location - About 1 hr to fix
                      src/server/routes/entity/entity.tsx on lines 548..553

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

                      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 (relationship.sourceBbid === entityBBID) {
                                              accumulator.push(relationship.targetBbid);
                                          }
                                          else if (relationship.targetBbid === entityBBID) {
                                              accumulator.push(relationship.sourceBbid);
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 1 other location - About 1 hr to fix
                      src/server/routes/entity/entity.tsx on lines 356..361

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

                      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

                                  const markup = ReactDOMServer.renderToString(
                                      <Layout {...propHelpers.extractLayoutProps(props)}>
                                          <EntityComponent
                                              {...propHelpers.extractEntityProps(props)}
                                          />
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 6 other locations - About 1 hr to fix
                      src/server/routes/adminLogs.tsx on lines 48..52
                      src/server/routes/entity/entity.tsx on lines 1393..1397
                      src/server/routes/identifier-types.tsx on lines 34..38
                      src/server/routes/relationship-types.tsx on lines 74..78
                      src/server/routes/type-editor/identifier-type.tsx on lines 45..49
                      src/server/routes/type-editor/relationship-type.tsx on lines 45..49

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

                      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

                          const markup = ReactDOMServer.renderToString(
                              <Layout {...propHelpers.extractLayoutProps(props)}>
                                  <PreviewPage {...propHelpers.extractPreviewProps(props)}/>
                              </Layout>
                          );
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 6 other locations - About 1 hr to fix
                      src/server/routes/adminLogs.tsx on lines 48..52
                      src/server/routes/entity/entity.tsx on lines 156..162
                      src/server/routes/identifier-types.tsx on lines 34..38
                      src/server/routes/relationship-types.tsx on lines 74..78
                      src/server/routes/type-editor/identifier-type.tsx on lines 45..49
                      src/server/routes/type-editor/relationship-type.tsx on lines 45..49

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

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

                          const oldLanguageSet = await (
                              languageSetID &&
                              orm.LanguageSet.forge({id: languageSetID})
                                  .fetch({transacting, withRelated: ['languages']})
                          );
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 4 other locations - About 50 mins to fix
                      src/server/routes/entity/entity.tsx on lines 704..708
                      src/server/routes/entity/entity.tsx on lines 756..760
                      src/server/routes/entity/entity.tsx on lines 771..775
                      src/server/routes/entity/entity.tsx on lines 814..818

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

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

                          const oldPublisherSet = await (
                              publisherSetID &&
                              orm.PublisherSet.forge({id: publisherSetID})
                                  .fetch({transacting, withRelated: ['publishers']})
                          );
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 4 other locations - About 50 mins to fix
                      src/server/routes/entity/entity.tsx on lines 704..708
                      src/server/routes/entity/entity.tsx on lines 741..745
                      src/server/routes/entity/entity.tsx on lines 771..775
                      src/server/routes/entity/entity.tsx on lines 814..818

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

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

                          const oldAuthorCredit = await (
                              authorCreditID &&
                              orm.AuthorCredit.forge({id: authorCreditID})
                                  .fetch({transacting, withRelated: ['names']})
                          );
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 4 other locations - About 50 mins to fix
                      src/server/routes/entity/entity.tsx on lines 741..745
                      src/server/routes/entity/entity.tsx on lines 756..760
                      src/server/routes/entity/entity.tsx on lines 771..775
                      src/server/routes/entity/entity.tsx on lines 814..818

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

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

                          const oldReleaseEventSet = await (
                              releaseEventSetID &&
                              orm.ReleaseEventSet.forge({id: releaseEventSetID})
                                  .fetch({transacting, withRelated: ['releaseEvents']})
                          );
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 4 other locations - About 50 mins to fix
                      src/server/routes/entity/entity.tsx on lines 704..708
                      src/server/routes/entity/entity.tsx on lines 741..745
                      src/server/routes/entity/entity.tsx on lines 756..760
                      src/server/routes/entity/entity.tsx on lines 814..818

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

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

                          const oldSet = await (
                              id &&
                              orm.LanguageSet.forge({id})
                                  .fetch({transacting, withRelated: ['languages']})
                          );
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 4 other locations - About 50 mins to fix
                      src/server/routes/entity/entity.tsx on lines 704..708
                      src/server/routes/entity/entity.tsx on lines 741..745
                      src/server/routes/entity/entity.tsx on lines 756..760
                      src/server/routes/entity/entity.tsx on lines 771..775

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

                      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

                              const oldRelationshipAttributeSet = await (
                                  id &&
                                  new RelationshipAttributeSet({id}).fetch({
                                      require: false,
                                      transacting, withRelated: ['relationshipAttributes.value']
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 3 other locations - About 40 mins to fix
                      src/server/routes/entity/entity.tsx on lines 860..863
                      src/server/routes/entity/entity.tsx on lines 877..883
                      src/server/routes/entity/entity.tsx on lines 922..928

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

                      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

                          const oldIdentifierSet = await (
                              id &&
                              new IdentifierSet({id}).fetch({
                                  require: false,
                                  transacting, withRelated: ['identifiers']
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 3 other locations - About 40 mins to fix
                      src/server/routes/entity/entity.tsx on lines 860..863
                      src/server/routes/entity/entity.tsx on lines 897..903
                      src/server/routes/entity/entity.tsx on lines 922..928

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

                      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

                          const oldAliasSet = await (
                              id &&
                              new AliasSet({id}).fetch({require: false, transacting, withRelated: ['aliases']})
                          );
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 3 other locations - About 40 mins to fix
                      src/server/routes/entity/entity.tsx on lines 877..883
                      src/server/routes/entity/entity.tsx on lines 897..903
                      src/server/routes/entity/entity.tsx on lines 922..928

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

                      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

                          const oldRelationshipSet = await (
                              id &&
                              new RelationshipSet({id}).fetch({
                                  require: false,
                                  transacting, withRelated: ['relationships']
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx and 3 other locations - About 40 mins to fix
                      src/server/routes/entity/entity.tsx on lines 860..863
                      src/server/routes/entity/entity.tsx on lines 877..883
                      src/server/routes/entity/entity.tsx on lines 897..903

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

                      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