bookbrainz/bookbrainz-site

View on GitHub

Showing 1,033 of 1,033 total issues

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

router.get('/:bbid/relationships',
    makeEntityLoader('Work', utils.relationshipsRelations, workError),
    async (req, res) => {
        const workRelationshipList = await getEntityRelationships(res.locals.entity);
        return res.status(200).send(workRelationshipList);
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 209..214

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('EditionGroup', utils.relationshipsRelations, editionGroupError),
    async (req, res) => {
        const editionGroupRelationshipList = await getEntityRelationships(res.locals.entity);
        return res.status(200).send(editionGroupRelationshipList);
Severity: Major
Found in src/api/routes/edition-group.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.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 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('Edition', utils.aliasesRelations, editionError),
    async (req, res) => {
        const editionAliasesList = await getEntityAliases(res.locals.entity);
        return res.status(200).send(editionAliasesList);
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 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 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 2 locations. Consider refactoring.
Open

                    {
                        this.props.isOwner ?
                            <Button
                                className="margin-bottom-d5"
                                size="sm"
Severity: Major
Found in src/client/components/pages/collection.js and 1 other location - About 1 hr to fix
src/client/components/pages/collection.js on lines 306..317

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

                            <Button
                                className="margin-top-d15"
                                href={`/work/create?${_kebabCase(entity.type)}=${entity.bbid}`}
                                variant="success"
                            >
Severity: Major
Found in src/client/components/pages/entities/author.js and 1 other location - About 1 hr to fix
src/client/components/pages/entities/work-table.js on lines 123..129

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('Author', utils.identifiersRelations, authorError),
    async (req, res) => {
        const authorIdentifiersList = await getEntityIdentifiers(res.locals.entity);
        return res.status(200).send(authorIdentifiersList);
Severity: Major
Found in src/api/routes/author.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 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 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('Series', utils.aliasesRelations, seriesError),
    async (req, res) => {
        const seriesAliasesList = await getEntityAliases(res.locals.entity);
        return res.status(200).send(seriesAliasesList);
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 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/aliases',
    makeEntityLoader('EditionGroup', utils.aliasesRelations, editionGroupError),
    async (req, res) => {
        const editionGroupAliasesList = await getEntityAliases(res.locals.entity);
        return res.status(200).send(editionGroupAliasesList);
Severity: Major
Found in src/api/routes/edition-group.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 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 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('Edition', utils.identifiersRelations, editionError),
    async (req, res) => {
        const editionIdentifiersList = await getEntityIdentifiers(res.locals.entity);
        return res.status(200).send(editionIdentifiersList);
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 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 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('Author', utils.aliasesRelations, authorError),
    async (req, res) => {
        const authorAliasesList = await getEntityAliases(res.locals.entity);
        return res.status(200).send(authorAliasesList);
Severity: Major
Found in src/api/routes/author.js and 17 other locations - About 1 hr to fix
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 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('EditionGroup', utils.identifiersRelations, editionGroupError),
    async (req, res) => {
        const editionGroupIdentifiersList = await getEntityIdentifiers(res.locals.entity);
        return res.status(200).send(editionGroupIdentifiersList);
Severity: Major
Found in src/api/routes/edition-group.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 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 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('Author', utils.relationshipsRelations, authorError),
    async (req, res) => {
        const authorRelationshipList = await getEntityRelationships(res.locals.entity);
        return res.status(200).send(authorRelationshipList);
Severity: Major
Found in src/api/routes/author.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/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 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('Series', utils.relationshipsRelations, seriesError),
    async (req, res) => {
        const seriesRelationshipList = await getEntityRelationships(res.locals.entity);
        return res.status(200).send(seriesRelationshipList);
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 190..195
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 2 locations. Consider refactoring.
Open

                    {
                        this.props.isCollaborator ?
                            <Button
                                className="margin-bottom-d5"
                                size="sm"
Severity: Major
Found in src/client/components/pages/collection.js and 1 other location - About 1 hr to fix
src/client/components/pages/collection.js on lines 294..305

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

                    <Button
                        className="margin-top-d15"
                        href={`/work/create?${_kebabCase(entity.type)}=${entity.bbid}`}
                        variant="success"
                    >
Severity: Major
Found in src/client/components/pages/entities/work-table.js and 1 other location - About 1 hr to fix
src/client/components/pages/entities/author.js on lines 173..179

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

    const handleInputChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {
          const {name, value} = event.target;
          setFormData((prevFormData) => ({
            ...prevFormData,
            [name]: value
Severity: Major
Found in src/client/components/forms/type-editor/identifier-type.tsx and 1 other location - About 1 hr to fix
src/client/components/forms/type-editor/relationship-type.tsx on lines 144..150

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

    const handleInputChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {
          const {name, value} = event.target;
          setFormData((prevFormData) => ({
            ...prevFormData,
            [name]: value
src/client/components/forms/type-editor/identifier-type.tsx on lines 102..108

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

Function results has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        const results = this.props.results.map((result) => {
            if (!result) {
                return null;
            }
            const id = getId(result);
Severity: Minor
Found in src/client/components/pages/parts/search-results.js - About 1 hr to fix

    Function renderRelationshipSelect has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        renderRelationshipSelect() {
            const {baseEntity, relationshipTypes} = this.props;
    
            const otherEntity = {
                bbid: _.get(this.state, ['targetEntity', 'id']),

      Function validateUnifiedForm has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      function validateUnifiedForm(body:Record<string, any>):boolean {
          for (const entityKey in body) {
              if (Object.prototype.hasOwnProperty.call(body, entityKey)) {
                  const entityForm = body[entityKey];
                  const entityType = _.camelCase(entityForm.type);
      Severity: Minor
      Found in src/server/helpers/entityRouteUtils.tsx - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

      Severity
      Category
      Status
      Source
      Language