bookbrainz/bookbrainz-site

View on GitHub

Showing 1,033 of 1,033 total issues

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

                        <Form.Label>
                            Type
                            <OverlayTrigger delay={50} overlay={tooltip}>
                                <FontAwesomeIcon
                                    className="margin-left-0-5"
Severity: Major
Found in src/client/entity-editor/work-section/work-section.tsx and 5 other locations - About 1 hr to fix
src/client/entity-editor/edition-group-section/edition-group-section.tsx on lines 96..104
src/client/entity-editor/edition-section/edition-section.tsx on lines 389..397
src/client/entity-editor/edition-section/edition-section.tsx on lines 411..419
src/client/entity-editor/series-section/series-section.tsx on lines 187..195
src/client/entity-editor/series-section/series-section.tsx on lines 208..216

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

                        <Form.Label>
                            Ordering Type
                            <OverlayTrigger delay={50} overlay={orderingTooltip}>
                                <FontAwesomeIcon
                                    className="margin-left-0-5"
Severity: Major
Found in src/client/entity-editor/series-section/series-section.tsx and 5 other locations - About 1 hr to fix
src/client/entity-editor/edition-group-section/edition-group-section.tsx on lines 96..104
src/client/entity-editor/edition-section/edition-section.tsx on lines 389..397
src/client/entity-editor/edition-section/edition-section.tsx on lines 411..419
src/client/entity-editor/series-section/series-section.tsx on lines 208..216
src/client/entity-editor/work-section/work-section.tsx on lines 179..187

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

        const markup = ReactDOMServer.renderToString(
            <Layout {...propHelpers.extractLayoutProps(props)}>
                <SearchPage
                    user={props.user}
                    {...propHelpers.extractChildProps(props)}
Severity: Major
Found in src/server/routes/search.tsx and 4 other locations - About 1 hr to fix
src/server/routes/adminPanel.tsx on lines 84..91
src/server/routes/entity/entity.tsx on lines 215..222
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 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

                                                <Button
                                                    className="w-100"
                                                    href="#"
                                                    role="button"
                                                    variant="warning"
src/client/components/forms/type-editor/relationship-type.tsx on lines 390..399

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

export function debouncedUpdateAliasSortName(
    rowId: number, value: string
): Action {
    return {
        meta: {debounce: 'keystroke'},
Severity: Major
Found in src/client/entity-editor/alias-editor/actions.ts and 1 other location - About 1 hr to fix
src/client/entity-editor/alias-editor/actions.ts on lines 46..55

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

                        <Form.Label>
                            Format
                            <OverlayTrigger delay={50} overlay={formatTooltip}>
                                <FontAwesomeIcon
                                    className="margin-left-0-5"
src/client/entity-editor/edition-group-section/edition-group-section.tsx on lines 96..104
src/client/entity-editor/edition-section/edition-section.tsx on lines 411..419
src/client/entity-editor/series-section/series-section.tsx on lines 187..195
src/client/entity-editor/series-section/series-section.tsx on lines 208..216
src/client/entity-editor/work-section/work-section.tsx on lines 179..187

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

export function debouncedUpdateAliasName(rowId: number, value: string): Action {
    return {
        meta: {debounce: 'keystroke'},
        payload: {
            rowId,
Severity: Major
Found in src/client/entity-editor/alias-editor/actions.ts and 1 other location - About 1 hr to fix
src/client/entity-editor/alias-editor/actions.ts on lines 67..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 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

                                                <Button
                                                    className="w-100"
                                                    href="#"
                                                    role="button"
                                                    variant="danger"
src/client/components/forms/type-editor/relationship-type.tsx on lines 380..389

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

Function getEntityRelationships has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export function getEntityRelationships(entity: any) {
    return _.isNil(entity) ? null :
        {
            bbid: _.get(entity, 'bbid', null),
            relationships: _.get(entity, 'relationshipSet.relationships', []).map((relationship) => {
Severity: Minor
Found in src/api/helpers/formatEntityData.ts - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Function CoverTab has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function CoverTab(props:CoverProps) {
    const {publisherValue: publishers, onPublisherChange, identifierEditorVisible,
        onClearPublisher, handleClearPublishers, modalIsOpen, ...rest} = props;
    const publisherValue:EntitySelect[] = Object.values(convertMapToObject(publishers ?? {}));
    const onChangeHandler = React.useCallback((value:EntitySelect[], action) => {
Severity: Minor
Found in src/client/unified-form/cover-tab/cover-tab.tsx - About 1 hr to fix

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

                editionsJSON.map(edition => getEditionBasicInfo(edition))
                    .filter(relationshipsFilterMethod)
                    .forEach((filteredEdition) => {
                        // added relationship to make the output consistent
                        editionRelationshipList.push({entity: filteredEdition, relationship: {}});
    Severity: Major
    Found in src/api/routes/edition.js and 2 other locations - About 1 hr to fix
    src/api/routes/edition.js on lines 389..394
    src/api/routes/publisher.js on lines 364..369

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

    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

        return {
            alert,
            authorCreator,
            funRunner,
            hotOffThePress,
    Severity: Major
    Found in src/server/helpers/achievement.js and 1 other location - About 1 hr to fix
    src/client/entity-editor/name-section/name-section.js on lines 171..185

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

    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 {
                disambiguationDefaultValue,
                entityType,
                exactMatches: immutableExactMatches,
                languageOptions,
    Severity: Major
    Found in src/client/entity-editor/name-section/name-section.js and 1 other location - About 1 hr to fix
    src/server/helpers/achievement.js on lines 620..634

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

    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 buttonAfter = (
                                            <Button
                                                size="sm"
                                                type="button"
                                                variant="danger"
    Severity: Major
    Found in src/client/components/forms/userCollection.js and 1 other location - About 1 hr to fix
    src/client/components/pages/parts/add-entity-to-collection-modal.js on lines 146..155

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

    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 buttonAfter = (
                                        <Button
                                            size="sm"
                                            type="button"
                                            variant="danger"
    src/client/components/forms/userCollection.js on lines 265..274

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 66.

    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

                publishers.map(publisher => getPublisherBasicInfo(publisher))
                    .filter(relationshipsFilterMethod)
                    .forEach((filteredEdition) => {
                        // added relationship to make the output consistent
                        publisherRelationshipList.push({entity: filteredEdition, relationship: {}});
    Severity: Major
    Found in src/api/routes/publisher.js and 2 other locations - About 1 hr to fix
    src/api/routes/edition.js on lines 389..394
    src/api/routes/edition.js on lines 404..409

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

    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

                editions.map(edition => getEditionBasicInfo(edition))
                    .filter(relationshipsFilterMethod)
                    .forEach((filteredEdition) => {
                        // added relationship to make the output consistent
                        editionRelationshipList.push({entity: filteredEdition, relationship: {}});
    Severity: Major
    Found in src/api/routes/edition.js and 2 other locations - About 1 hr to fix
    src/api/routes/edition.js on lines 404..409
    src/api/routes/publisher.js on lines 364..369

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

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

    router.get('/:bbid/revisions', (req, res, next) => {
        const {PublisherRevision} = req.app.locals.orm;
        _setPublisherTitle(res);
        entityRoutes.displayRevisions(req, res, next, PublisherRevision);
    });
    Severity: Major
    Found in src/server/routes/entity/publisher.ts and 11 other locations - About 1 hr to fix
    src/server/routes/entity/author.ts on lines 237..241
    src/server/routes/entity/author.ts on lines 243..247
    src/server/routes/entity/edition-group.ts on lines 231..235
    src/server/routes/entity/edition-group.ts on lines 237..241
    src/server/routes/entity/edition.ts on lines 376..380
    src/server/routes/entity/edition.ts on lines 382..386
    src/server/routes/entity/publisher.ts on lines 249..253
    src/server/routes/entity/series.ts on lines 232..236
    src/server/routes/entity/series.ts on lines 238..242
    src/server/routes/entity/work.ts on lines 256..260
    src/server/routes/entity/work.ts on lines 262..266

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

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

    router.get('/:bbid/revisions/revisions', (req, res, next) => {
        const {WorkRevision} = req.app.locals.orm;
        _setWorkTitle(res);
        entityRoutes.updateDisplayedRevisions(req, res, next, WorkRevision);
    });
    Severity: Major
    Found in src/server/routes/entity/work.ts and 11 other locations - About 1 hr to fix
    src/server/routes/entity/author.ts on lines 237..241
    src/server/routes/entity/author.ts on lines 243..247
    src/server/routes/entity/edition-group.ts on lines 231..235
    src/server/routes/entity/edition-group.ts on lines 237..241
    src/server/routes/entity/edition.ts on lines 376..380
    src/server/routes/entity/edition.ts on lines 382..386
    src/server/routes/entity/publisher.ts on lines 243..247
    src/server/routes/entity/publisher.ts on lines 249..253
    src/server/routes/entity/series.ts on lines 232..236
    src/server/routes/entity/series.ts on lines 238..242
    src/server/routes/entity/work.ts on lines 256..260

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 66.

    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