bookbrainz/bookbrainz-site

View on GitHub

Showing 1,033 of 1,033 total issues

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

                        <Nav.Item>
                            <Nav.Link
                                active={tabActive === 3}
                                href={`/editor/${editor.id}/collections`}
                            >
Severity: Major
Found in src/client/containers/editor.js and 3 other locations - About 1 hr to fix
src/client/containers/editor.js on lines 56..63
src/client/containers/editor.js on lines 64..71
src/client/containers/editor.js on lines 72..79

Duplicated Code

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

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

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

Tuning

This issue has a mass of 72.

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

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

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

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

Refactorings

Further Reading

Function diffRevisionsWithParents has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function diffRevisionsWithParents(orm, entityRevisions, entityType) {
    // entityRevisions - collection of *entityType*_revisions matching id
    const promises = entityRevisions.map(
        async (revision) => {
            const dataId = revision.get('dataId');
Severity: Minor
Found in src/server/routes/revision.js - About 1 hr to fix

    Function dateValidator has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function dateValidator(dayObj, monthObj, yearObj) {
        const year = Number.parseInt(yearObj, 10);
        const month = Number.parseInt(monthObj, 10);
        const day = Number.parseInt(dayObj, 10);
    
    
    Severity: Minor
    Found in src/client/entity-editor/validators/date.js - About 1 hr to fix

      Function constructPrivsChangeStatement has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function constructPrivsChangeStatement(logData: AdminLogDataT) {
          const {newPrivs, oldPrivs, targetUserId, targetUser, adminId, admin} = logData;
          const {privsAdded, privsRemoved} = getPrivsChanged(newPrivs, oldPrivs);
      
          let grantStatement = '';
      Severity: Minor
      Found in src/client/helpers/adminLogs.tsx - About 1 hr to fix

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

        async function loadEntityRelationships(entity, orm, transacting): Promise<any> {
            async function getEntityWithAlias(relEntity) {
                const redirectBbid = await orm.func.entity.recursivelyGetRedirectBBID(orm, relEntity.bbid, null);
                const model = commonUtils.getEntityModelByType(orm, relEntity.type);
                return model.forge({bbid: redirectBbid})
        Severity: Minor
        Found in src/server/routes/merge.ts - 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 cleanupOnExit has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function cleanupOnExit(cleanupPromise) {
                process.on('asyncExit', () => {
                    cleanupPromise().then(() => {
                        console.log('Cleanup process finished');
                        process.exit(0);
            Severity: Minor
            Found in src/common/helpers/appCleanup.js - About 1 hr to fix

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

              router.get('/:bbid',
                  makeEntityLoader('Publisher', publisherBasicRelations, publisherError),
                  async (req, res) => {
                      const publisherBasicInfo = await getPublisherBasicInfo(res.locals.entity);
                      return res.status(200).send(publisherBasicInfo);
              Severity: Major
              Found in src/api/routes/publisher.js and 5 other locations - About 1 hr to fix
              src/api/routes/author.js on lines 135..140
              src/api/routes/edition-group.js on lines 123..128
              src/api/routes/edition.js on lines 159..164
              src/api/routes/series.js on lines 117..122
              src/api/routes/work.js on lines 133..138

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

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

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

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

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

              Refactorings

              Further Reading

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

              router.get('/:bbid',
                  makeEntityLoader('EditionGroup', editionGroupBasicRelations, editionGroupError),
                  async (req, res) => {
                      const editionGroupBasicInfo = await getEditionGroupBasicInfo(res.locals.entity);
                      return res.status(200).send(editionGroupBasicInfo);
              Severity: Major
              Found in src/api/routes/edition-group.js and 5 other locations - About 1 hr to fix
              src/api/routes/author.js on lines 135..140
              src/api/routes/edition.js on lines 159..164
              src/api/routes/publisher.js on lines 139..144
              src/api/routes/series.js on lines 117..122
              src/api/routes/work.js on lines 133..138

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

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

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

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

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

              Refactorings

              Further Reading

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

              router.get('/:bbid',
                  makeEntityLoader('Edition', editionBasicRelations, editionError),
                  async (req, res) => {
                      const editionBasicInfo = await getEditionBasicInfo(res.locals.entity);
                      return res.status(200).send(editionBasicInfo);
              Severity: Major
              Found in src/api/routes/edition.js and 5 other locations - About 1 hr to fix
              src/api/routes/author.js on lines 135..140
              src/api/routes/edition-group.js on lines 123..128
              src/api/routes/publisher.js on lines 139..144
              src/api/routes/series.js on lines 117..122
              src/api/routes/work.js on lines 133..138

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

              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

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

              function mapDispatchToProps(dispatch: Dispatch<Action>): DispatchProps {
                  return {
                      onDepthChange: (event) => dispatch(debouncedUpdateDepth(
                          event.target.value ? parseInt(event.target.value, 10) : null
                      )),
              Severity: Minor
              Found in src/client/entity-editor/edition-section/edition-section.tsx - About 1 hr to fix

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

                router.get('/:bbid',
                    makeEntityLoader('Author', authorBasicRelations, authorError),
                    async (req, res) => {
                        const authorBasicInfo = await getAuthorBasicInfo(res.locals.entity);
                        return res.status(200).send(authorBasicInfo);
                Severity: Major
                Found in src/api/routes/author.js and 5 other locations - About 1 hr to fix
                src/api/routes/edition-group.js on lines 123..128
                src/api/routes/edition.js on lines 159..164
                src/api/routes/publisher.js on lines 139..144
                src/api/routes/series.js on lines 117..122
                src/api/routes/work.js on lines 133..138

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

                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 (_.findIndex(sortNameOptions, ['label', entity.defaultAlias.sortName]) === -1) {
                            sortNameOptions.push({label: entity.defaultAlias.sortName, value: entity.defaultAlias.sortName});
                        }
                Severity: Major
                Found in src/client/entity-editor/name-section/name-section-merge.js and 1 other location - About 1 hr to fix
                src/client/entity-editor/name-section/name-section-merge.js on lines 79..81

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

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

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

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

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

                Refactorings

                Further Reading

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

                router.get('/:bbid',
                    makeEntityLoader('Series', seriesBasicRelations, seriesError),
                    async (req, res) => {
                        const seriesBasicInfo = await getSeriesBasicInfo(res.locals.entity);
                        return res.status(200).send(seriesBasicInfo);
                Severity: Major
                Found in src/api/routes/series.js and 5 other locations - About 1 hr to fix
                src/api/routes/author.js on lines 135..140
                src/api/routes/edition-group.js on lines 123..128
                src/api/routes/edition.js on lines 159..164
                src/api/routes/publisher.js on lines 139..144
                src/api/routes/work.js on lines 133..138

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

                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 (_.findIndex(nameOptions, ['label', entity.defaultAlias.name]) === -1) {
                            nameOptions.push({label: entity.defaultAlias.name, value: entity.defaultAlias.name});
                        }
                Severity: Major
                Found in src/client/entity-editor/name-section/name-section-merge.js and 1 other location - About 1 hr to fix
                src/client/entity-editor/name-section/name-section-merge.js on lines 82..84

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

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

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

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

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

                Refactorings

                Further Reading

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

                router.get('/:bbid',
                    makeEntityLoader('Work', workBasicRelations, workError),
                    async (req, res) => {
                        const workBasicInfo = await getWorkBasicInfo(res.locals.entity);
                        return res.status(200).send(workBasicInfo);
                Severity: Major
                Found in src/api/routes/work.js and 5 other locations - About 1 hr to fix
                src/api/routes/author.js on lines 135..140
                src/api/routes/edition-group.js on lines 123..128
                src/api/routes/edition.js on lines 159..164
                src/api/routes/publisher.js on lines 139..144
                src/api/routes/series.js on lines 117..122

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

                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

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

                    render() {
                        const {type, query, results} = this.state;
                        const querySearchParams = `q=${query}${type ? `&type=${type}` : ''}`;
                        return (
                            <div id="pageWithPagination">
                Severity: Minor
                Found in src/client/components/pages/search.tsx - About 1 hr to fix

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

                                          <Form.Label>
                                              {annotationLabel}
                                              <OverlayTrigger delay={50} overlay={tooltip}>
                                                  <FontAwesomeIcon
                                                      className="margin-left-0-5"
                  src/client/entity-editor/submission-section/submission-section.js on lines 77..85

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

                  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

                                          <Form.Label>
                                              {editNoteLabel}
                                              <OverlayTrigger delay={50} overlay={tooltip}>
                                                  <FontAwesomeIcon
                                                      className="margin-left-0-5"
                  src/client/entity-editor/annotation-section/annotation-section.js on lines 70..78

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

                  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

                              <Form.Label>
                                  {label}
                                  <OverlayTrigger delay={50} overlay={tooltip}>
                                      <FontAwesomeIcon className="margin-left-0-5" icon={faQuestionCircle}/>
                                  </OverlayTrigger>
                  Severity: Major
                  Found in src/client/entity-editor/common/sort-name-field.tsx and 3 other locations - About 1 hr to fix
                  src/client/entity-editor/author-credit-editor/author-credit-section.tsx on lines 161..169
                  src/client/entity-editor/common/language-field.tsx on lines 99..107
                  src/client/entity-editor/name-section/disambiguation-field.tsx on lines 69..77

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language