bookbrainz/bookbrainz-site

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

Summary

Maintainability
F
1 wk
Test Coverage

File entity.tsx has 1110 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (C) 2016  Ben Ockmore
 *               2016  Sean Burke
 *                 2021  Akash Gupta
 * This program is free software; you can redistribute it and/or modify
Severity: Major
Found in src/server/routes/entity/entity.tsx - About 2 days to fix

    Function processMergeOperation has 135 lines of code (exceeds 25 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: Major
    Found in src/server/routes/entity/entity.tsx - About 5 hrs to fix

      Function processSingleEntity has 99 lines of code (exceeds 25 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: Major
      Found in src/server/routes/entity/entity.tsx - About 3 hrs to fix

        Function displayEntity has 99 lines of code (exceeds 25 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: Major
        Found in src/server/routes/entity/entity.tsx - About 3 hrs to fix

          Function processEditionSets has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          async function processEditionSets(
              orm: any,
              currentEntity: Record<string, unknown> | null | undefined,
              body: ProcessEditionSetsBody,
              transacting: Transaction
          Severity: Major
          Found in src/server/routes/entity/entity.tsx - About 2 hrs to fix

            Function deleteRelationships has 47 lines of code (exceeds 25 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 1 hr to fix

              Function handleDelete has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function handleDelete(
                  orm: any, req: PassportRequest, res: $Response, HeaderModel: any,
                  RevisionModel: any
              ) {
                  const {entity}: {entity?: any} = res.locals;
              Severity: Minor
              Found in src/server/routes/entity/entity.tsx - About 1 hr to fix

                Function alertPromise has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    let alertPromise = editorEntityVisitPromise.then((visitAlert) => {
                        let alertIds = [];
                        if (visitAlert.alert) {
                            alertIds = alertIds.concat(visitAlert.alert.split(',').map(
                                (id) => parseInt(id, 10)
                Severity: Minor
                Found in src/server/routes/entity/entity.tsx - About 1 hr to fix

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

                  export async function getChangedProps(
                      orm, transacting, isNew, currentEntity, body, entityType,
                      newRevision, derivedProps
                  ) {
                      const aliasSetPromise =
                  Severity: Minor
                  Found in src/server/routes/entity/entity.tsx - About 1 hr to fix

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

                        const entityDeletePromise = bookshelf.transaction(async (transacting) => {
                            if (!body.note || !body.note.length) {
                                throw new error.FormSubmissionError('A revision note is required when deleting an entity');
                            }
                    
                    
                    Severity: Minor
                    Found in src/server/routes/entity/entity.tsx - About 1 hr to fix

                      Function displayRevisions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export async function displayRevisions(
                          req: PassportRequest, res: $Response, next: NextFunction, RevisionModel: any
                      ) {
                          const size = _.isString(req.query.size) ? parseInt(req.query.size, 10) : 20;
                          const from = _.isString(req.query.from) ? parseInt(req.query.from, 10) : 0;
                      Severity: Minor
                      Found in src/server/routes/entity/entity.tsx - About 1 hr to fix

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

                          export async function saveEntitiesAndFinishRevision(
                              orm, transacting, isNew: boolean, newRevision: any, mainEntity: any,
                              updatedEntities: any[], editorID: number, note: string
                          ) {
                              const parentRevisionIDs = _.compact(_.uniq(updatedEntities.map(
                          Severity: Minor
                          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 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 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 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 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 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 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

                                      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 _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 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

                                              Similar blocks of code found in 5 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 4 other locations - About 1 hr to fix
                                              src/server/routes/adminPanel.tsx on lines 84..91
                                              src/server/routes/search.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 === 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 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 8 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 7 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/searchAdmin.tsx on lines 44..50
                                              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 8 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 7 other locations - About 1 hr to fix
                                              src/server/routes/adminLogs.tsx on lines 48..52
                                              src/server/routes/entity/entity.tsx on lines 1401..1405
                                              src/server/routes/identifier-types.tsx on lines 34..38
                                              src/server/routes/relationship-types.tsx on lines 74..78
                                              src/server/routes/searchAdmin.tsx on lines 44..50
                                              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 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 712..716
                                              src/server/routes/entity/entity.tsx on lines 749..753
                                              src/server/routes/entity/entity.tsx on lines 764..768
                                              src/server/routes/entity/entity.tsx on lines 779..783

                                              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 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 712..716
                                              src/server/routes/entity/entity.tsx on lines 764..768
                                              src/server/routes/entity/entity.tsx on lines 779..783
                                              src/server/routes/entity/entity.tsx on lines 822..826

                                              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 (
                                                      existingAuthorCreditID &&
                                                      orm.AuthorCredit.forge({id: existingAuthorCreditID})
                                                          .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 749..753
                                              src/server/routes/entity/entity.tsx on lines 764..768
                                              src/server/routes/entity/entity.tsx on lines 779..783
                                              src/server/routes/entity/entity.tsx on lines 822..826

                                              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 712..716
                                              src/server/routes/entity/entity.tsx on lines 749..753
                                              src/server/routes/entity/entity.tsx on lines 779..783
                                              src/server/routes/entity/entity.tsx on lines 822..826

                                              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 712..716
                                              src/server/routes/entity/entity.tsx on lines 749..753
                                              src/server/routes/entity/entity.tsx on lines 764..768
                                              src/server/routes/entity/entity.tsx on lines 822..826

                                              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 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 868..871
                                              src/server/routes/entity/entity.tsx on lines 905..911
                                              src/server/routes/entity/entity.tsx on lines 930..936

                                              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 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 868..871
                                              src/server/routes/entity/entity.tsx on lines 885..891
                                              src/server/routes/entity/entity.tsx on lines 930..936

                                              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 885..891
                                              src/server/routes/entity/entity.tsx on lines 905..911
                                              src/server/routes/entity/entity.tsx on lines 930..936

                                              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 868..871
                                              src/server/routes/entity/entity.tsx on lines 885..891
                                              src/server/routes/entity/entity.tsx on lines 905..911

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

                                                  const newPublisherSet = await orm.func.publisher.updatePublisherSet(
                                                      orm, transacting, oldPublisherSet,
                                                      publishers.map((publisherBBID) => ({bbid: publisherBBID}))
                                                  );
                                              Severity: Minor
                                              Found in src/server/routes/entity/entity.tsx and 1 other location - About 35 mins to fix
                                              src/server/routes/entity/entity.tsx on lines 757..760

                                              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

                                                  const newLanguageSet = await orm.func.language.updateLanguageSet(
                                                      orm, transacting, oldLanguageSet,
                                                      languages.map((languageID) => ({id: languageID}))
                                                  );
                                              Severity: Minor
                                              Found in src/server/routes/entity/entity.tsx and 1 other location - About 35 mins to fix
                                              src/server/routes/entity/entity.tsx on lines 772..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 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