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

    if (change.path.length > 7 && change.path[7] === 'textValue') {
        return [
            base.formatChange(change,
                `Relationship Attribute ${change.path[2]} -> Value`, (side) => side && [side])
        ];
Severity: Major
Found in src/server/helpers/diffFormatters/entity.js and 3 other locations - About 2 hrs to fix
src/server/helpers/diffFormatters/entity.js on lines 77..85
src/server/helpers/diffFormatters/entity.js on lines 87..95
src/server/helpers/diffFormatters/entity.js on lines 199..207

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

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

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

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

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

Refactorings

Further Reading

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

AddEntityToCollectionModal.propTypes = {
    closeModalAndShowMessage: PropTypes.func.isRequired,
    collectionId: PropTypes.string.isRequired,
    collectionType: PropTypes.string.isRequired,
    onCloseModal: PropTypes.func.isRequired,
src/client/components/pages/parts/privs-edit-modal.js on lines 179..185
src/client/entity-editor/submission-section/submission-section.js on lines 120..126

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

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

            <Row>
                <Col lg={lgCol}>
                    <ImmutableLanguageField
                        empty
                        isMulti
Severity: Major
Found in src/client/entity-editor/work-section/work-section.tsx and 1 other location - About 2 hrs to fix
src/client/entity-editor/edition-section/edition-section.tsx on lines 373..385

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

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

            <Row>
                <Col lg={colSpan}>
                    <ImmutableLanguageField
                        empty
                        isMulti
Severity: Major
Found in src/client/entity-editor/edition-section/edition-section.tsx and 1 other location - About 2 hrs to fix
src/client/entity-editor/work-section/work-section.tsx on lines 208..220

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

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 a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const {showLastModified, showOwner, showIfOwnerOrCollaborator, showPrivacy, results, tableHeading, user, ownerId} = this.props;
        const entityTypeSelect = (
            <DropdownButton
                className="margin-bottom-d5"
Severity: Minor
Found in src/client/components/pages/parts/collections-table.js - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function 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

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

                                    <Col className="margin-top-d5" md={6}>
                                        <Button
                                            block
                                            type="button"
                                            variant="primary"
    Severity: Major
    Found in src/client/components/forms/userCollection.js and 1 other location - About 2 hrs to fix
    src/client/components/forms/userCollection.js on lines 306..315

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

    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

                                            <Col className="margin-top-d5" md={6}>
                                                <Button
                                                    block
                                                    type="button"
                                                    variant="danger"
    Severity: Major
    Found in src/client/components/forms/userCollection.js and 1 other location - About 2 hrs to fix
    src/client/components/forms/userCollection.js on lines 251..261

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

    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

    File search-results.js has 252 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Copyright (C) 2015  Ohm Patel
     *               2016  Sean Burke
     *
     * This program is free software; you can redistribute it and/or modify
    Severity: Minor
    Found in src/client/components/pages/parts/search-results.js - About 2 hrs to fix

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

          render() {
              return (
                  this.state.results && this.state.results.length ?
                      <div id="PagerElement">
                          <hr className="thin"/>
      Severity: Minor
      Found in src/client/components/pages/parts/pager.js - About 2 hrs to fix

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

            render() {
                const labelElement = (
                    <ValidationLabel empty={this.props.empty} error={this.props.error}>
                        {this.props.label}
                    </ValidationLabel>
        Severity: Minor
        Found in src/client/entity-editor/common/entity-search-field-option.js - About 1 hr to fix

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

          function getInitState(
              baseEntity: Entity, initRelationship: _Relationship | null | undefined
          ): RelationshipModalState {
              if (_.isNull(initRelationship)) {
                  return {

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

            const EntityEditor = (props: Props) => {
                const {
                    aliasEditorVisible,
                    children,
                    heading,
            Severity: Minor
            Found in src/client/entity-editor/entity-editor.tsx - About 1 hr to fix

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

              router.get('/:bbid/aliases',
                  makeEntityLoader('Work', utils.aliasesRelations, workError),
                  async (req, res) => {
                      const workAliasesList = await getEntityAliases(res.locals.entity);
                      return res.status(200).send(workAliasesList);
              Severity: Major
              Found in src/api/routes/work.js and 17 other locations - About 1 hr to fix
              src/api/routes/author.js on lines 172..177
              src/api/routes/author.js on lines 207..212
              src/api/routes/author.js on lines 243..248
              src/api/routes/edition-group.js on lines 160..165
              src/api/routes/edition-group.js on lines 197..202
              src/api/routes/edition-group.js on lines 235..240
              src/api/routes/edition.js on lines 195..200
              src/api/routes/edition.js on lines 231..236
              src/api/routes/edition.js on lines 267..272
              src/api/routes/publisher.js on lines 175..180
              src/api/routes/publisher.js on lines 212..217
              src/api/routes/publisher.js on lines 249..254
              src/api/routes/series.js on lines 154..159
              src/api/routes/series.js on lines 190..195
              src/api/routes/series.js on lines 226..231
              src/api/routes/work.js on lines 209..214
              src/api/routes/work.js on lines 247..252

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

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

              router.get('/:bbid/aliases',
                  makeEntityLoader('Publisher', utils.aliasesRelations, publisherError),
                  async (req, res) => {
                      const publisherAliasesList = await getEntityAliases(res.locals.entity);
                      return res.status(200).send(publisherAliasesList);
              Severity: Major
              Found in src/api/routes/publisher.js and 17 other locations - About 1 hr to fix
              src/api/routes/author.js on lines 172..177
              src/api/routes/author.js on lines 207..212
              src/api/routes/author.js on lines 243..248
              src/api/routes/edition-group.js on lines 160..165
              src/api/routes/edition-group.js on lines 197..202
              src/api/routes/edition-group.js on lines 235..240
              src/api/routes/edition.js on lines 195..200
              src/api/routes/edition.js on lines 231..236
              src/api/routes/edition.js on lines 267..272
              src/api/routes/publisher.js on lines 212..217
              src/api/routes/publisher.js on lines 249..254
              src/api/routes/series.js on lines 154..159
              src/api/routes/series.js on lines 190..195
              src/api/routes/series.js on lines 226..231
              src/api/routes/work.js on lines 172..177
              src/api/routes/work.js on lines 209..214
              src/api/routes/work.js on lines 247..252

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

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

              router.get('/:bbid/identifiers',
                  makeEntityLoader('Publisher', utils.identifiersRelations, publisherError),
                  async (req, res) => {
                      const publisherIdentifiersList = await getEntityIdentifiers(res.locals.entity);
                      return res.status(200).send(publisherIdentifiersList);
              Severity: Major
              Found in src/api/routes/publisher.js and 17 other locations - About 1 hr to fix
              src/api/routes/author.js on lines 172..177
              src/api/routes/author.js on lines 207..212
              src/api/routes/author.js on lines 243..248
              src/api/routes/edition-group.js on lines 160..165
              src/api/routes/edition-group.js on lines 197..202
              src/api/routes/edition-group.js on lines 235..240
              src/api/routes/edition.js on lines 195..200
              src/api/routes/edition.js on lines 231..236
              src/api/routes/edition.js on lines 267..272
              src/api/routes/publisher.js on lines 175..180
              src/api/routes/publisher.js on lines 249..254
              src/api/routes/series.js on lines 154..159
              src/api/routes/series.js on lines 190..195
              src/api/routes/series.js on lines 226..231
              src/api/routes/work.js on lines 172..177
              src/api/routes/work.js on lines 209..214
              src/api/routes/work.js on lines 247..252

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

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

              router.get('/:bbid/relationships',
                  makeEntityLoader('Edition', utils.relationshipsRelations, editionError),
                  async (req, res) => {
                      const editionRelationshipList = await getEntityRelationships(res.locals.entity);
                      return res.status(200).send(editionRelationshipList);
              Severity: Major
              Found in src/api/routes/edition.js and 17 other locations - About 1 hr to fix
              src/api/routes/author.js on lines 172..177
              src/api/routes/author.js on lines 207..212
              src/api/routes/author.js on lines 243..248
              src/api/routes/edition-group.js on lines 160..165
              src/api/routes/edition-group.js on lines 197..202
              src/api/routes/edition-group.js on lines 235..240
              src/api/routes/edition.js on lines 195..200
              src/api/routes/edition.js on lines 231..236
              src/api/routes/publisher.js on lines 175..180
              src/api/routes/publisher.js on lines 212..217
              src/api/routes/publisher.js on lines 249..254
              src/api/routes/series.js on lines 154..159
              src/api/routes/series.js on lines 190..195
              src/api/routes/series.js on lines 226..231
              src/api/routes/work.js on lines 172..177
              src/api/routes/work.js on lines 209..214
              src/api/routes/work.js on lines 247..252

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

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

              router.get('/:bbid/identifiers',
                  makeEntityLoader('Work', utils.identifiersRelations, workError),
                  async (req, res) => {
                      const workIdentifiersList = await getEntityIdentifiers(res.locals.entity);
                      return res.status(200).send(workIdentifiersList);
              Severity: Major
              Found in src/api/routes/work.js and 17 other locations - About 1 hr to fix
              src/api/routes/author.js on lines 172..177
              src/api/routes/author.js on lines 207..212
              src/api/routes/author.js on lines 243..248
              src/api/routes/edition-group.js on lines 160..165
              src/api/routes/edition-group.js on lines 197..202
              src/api/routes/edition-group.js on lines 235..240
              src/api/routes/edition.js on lines 195..200
              src/api/routes/edition.js on lines 231..236
              src/api/routes/edition.js on lines 267..272
              src/api/routes/publisher.js on lines 175..180
              src/api/routes/publisher.js on lines 212..217
              src/api/routes/publisher.js on lines 249..254
              src/api/routes/series.js on lines 154..159
              src/api/routes/series.js on lines 190..195
              src/api/routes/series.js on lines 226..231
              src/api/routes/work.js on lines 172..177
              src/api/routes/work.js on lines 247..252

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

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

              router.get('/:bbid/identifiers',
                  makeEntityLoader('Series', utils.identifiersRelations, seriesError),
                  async (req, res) => {
                      const seriesIdentifiersList = await getEntityIdentifiers(res.locals.entity);
                      return res.status(200).send(seriesIdentifiersList);
              Severity: Major
              Found in src/api/routes/series.js and 17 other locations - About 1 hr to fix
              src/api/routes/author.js on lines 172..177
              src/api/routes/author.js on lines 207..212
              src/api/routes/author.js on lines 243..248
              src/api/routes/edition-group.js on lines 160..165
              src/api/routes/edition-group.js on lines 197..202
              src/api/routes/edition-group.js on lines 235..240
              src/api/routes/edition.js on lines 195..200
              src/api/routes/edition.js on lines 231..236
              src/api/routes/edition.js on lines 267..272
              src/api/routes/publisher.js on lines 175..180
              src/api/routes/publisher.js on lines 212..217
              src/api/routes/publisher.js on lines 249..254
              src/api/routes/series.js on lines 154..159
              src/api/routes/series.js on lines 226..231
              src/api/routes/work.js on lines 172..177
              src/api/routes/work.js on lines 209..214
              src/api/routes/work.js on lines 247..252

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

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

              router.get('/:bbid/relationships',
                  makeEntityLoader('Publisher', utils.relationshipsRelations, publisherError),
                  async (req, res) => {
                      const publisherRelationshipList = await getEntityRelationships(res.locals.entity);
                      return res.status(200).send(publisherRelationshipList);
              Severity: Major
              Found in src/api/routes/publisher.js and 17 other locations - About 1 hr to fix
              src/api/routes/author.js on lines 172..177
              src/api/routes/author.js on lines 207..212
              src/api/routes/author.js on lines 243..248
              src/api/routes/edition-group.js on lines 160..165
              src/api/routes/edition-group.js on lines 197..202
              src/api/routes/edition-group.js on lines 235..240
              src/api/routes/edition.js on lines 195..200
              src/api/routes/edition.js on lines 231..236
              src/api/routes/edition.js on lines 267..272
              src/api/routes/publisher.js on lines 175..180
              src/api/routes/publisher.js on lines 212..217
              src/api/routes/series.js on lines 154..159
              src/api/routes/series.js on lines 190..195
              src/api/routes/series.js on lines 226..231
              src/api/routes/work.js on lines 172..177
              src/api/routes/work.js on lines 209..214
              src/api/routes/work.js on lines 247..252

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

              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