bookbrainz/bookbrainz-site

View on GitHub

Showing 1,033 of 1,033 total issues

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

    const markup = ReactDOMServer.renderToString(
        <Layout {...propHelpers.extractLayoutProps(rest)}>
            <Provider store={store}>
                <EntityMerge
                    validate={getValidator(props.entityType)}
Severity: Major
Found in src/server/helpers/entityRouteUtils.tsx and 1 other location - About 3 hrs to fix
src/server/helpers/entityRouteUtils.tsx on lines 169..180

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

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 add-to-collection-modal.js has 310 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as bootstrap from 'react-bootstrap';
import {faPlus, faTimes} from '@fortawesome/free-solid-svg-icons';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import PropTypes from 'prop-types';
import React from 'react';
Severity: Minor
Found in src/client/components/pages/parts/add-to-collection-modal.js - About 3 hrs to fix

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

        render() {
            const warnMessage = 'Are you sure? You entered a date in the future!';
            const labelElement = (
                <ValidationLabel
                    empty={this.props.empty}
    Severity: Major
    Found in src/client/entity-editor/common/new-date-field.js - About 3 hrs to fix

      Function LicensingPage has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function LicensingPage(): JSX.Element {
          const CC0Link = 'http://creativecommons.org/publicdomain/zero/1.0/';
          const CC0Image = 'http://i.creativecommons.org/p/zero/1.0/88x31.png';
      
          const CCBYSALink = 'http://creativecommons.org/licenses/by-sa/4.0/';
      Severity: Major
      Found in src/client/components/pages/licensing.tsx - About 3 hrs to fix

        File userCollection.js has 308 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*
         * Copyright (C) 2020 Prabal Singh
         *
         * This program is free software; you can redistribute it and/or modify
         * it under the terms of the GNU General Public License as published by
        Severity: Minor
        Found in src/client/components/forms/userCollection.js - About 3 hrs to fix

          Function EntityMerge has 84 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const EntityMerge = (props: Props) => {
              const {
                  children,
                  mergingEntities,
                  identifierSet,
          Severity: Major
          Found in src/client/entity-editor/entity-merge.tsx - About 3 hrs to fix

            Function editionGroupToFormState has 84 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function editionGroupToFormState(editionGroup) {
                /** The front-end expects a language id rather than the language object. */
                const aliases = editionGroup.aliasSet ?
                    editionGroup.aliasSet.aliases.map(({languageId, ...rest}) => ({
                        ...rest,
            Severity: Major
            Found in src/server/routes/entity/edition-group.ts - About 3 hrs to fix

              File name-section.js has 306 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*
               * Copyright (C) 2016  Ben Ockmore
               *
               * This program is free software; you can redistribute it and/or modify
               * it under the terms of the GNU General Public License as published by
              Severity: Minor
              Found in src/client/entity-editor/name-section/name-section.js - About 3 hrs to fix

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

                    handleChangeEntity(newEnt, index) {
                        let newEntity;
                        if (!newEnt) {
                            newEntity = {
                                id: null,
                src/client/components/forms/userCollection.js on lines 119..138

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 101.

                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

                    handleChangeCollaborator(newCollab, index) {
                        let newCollaborator;
                        if (!newCollab) {
                            newCollaborator = {
                                id: null,
                Severity: Major
                Found in src/client/components/forms/userCollection.js and 1 other location - About 3 hrs to fix
                src/client/components/pages/parts/add-entity-to-collection-modal.js on lines 58..77

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 101.

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

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

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

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

                Refactorings

                Further Reading

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

                        if (!req.params.id) {
                            newRelationshipType = await RelationshipType.forge();
                            method = 'insert';
                        }
                        else {
                Severity: Major
                Found in src/server/helpers/typeRouteUtils.ts and 1 other location - About 3 hrs to fix
                src/server/helpers/typeRouteUtils.ts on lines 123..132

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

                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 className="text-right" lg={{offset: 9, span: 3}}>
                                    <Button variant="success" onClick={onAddAlias}>
                                        <FontAwesomeIcon icon={faPlus}/>
                                        <span>&nbsp;Add alias</span>
                Severity: Major
                Found in src/client/entity-editor/alias-editor/alias-modal-body.tsx and 1 other location - About 3 hrs to fix
                src/client/entity-editor/identifier-editor/identifier-modal-body.tsx on lines 45..52

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

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

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

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

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

                Refactorings

                Further Reading

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

                        if (!req.params.id) {
                            newIdentifierType = await IdentifierType.forge();
                            method = 'insert';
                        }
                        else {
                Severity: Major
                Found in src/server/helpers/typeRouteUtils.ts and 1 other location - About 3 hrs to fix
                src/server/helpers/typeRouteUtils.ts on lines 44..53

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

                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 className="text-right" lg={{offset: 9, span: 3}}>
                                    <Button variant="success" onClick={onAddIdentifier}>
                                        <FontAwesomeIcon icon={faPlus}/>
                                        <span>&nbsp;Add identifier</span>
                src/client/entity-editor/alias-editor/alias-modal-body.tsx on lines 49..56

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

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

                    render() {
                        return (
                            <div>
                                {
                                    this.props.user ?
                Severity: Major
                Found in src/client/components/pages/entities/footer.js - About 3 hrs to fix

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

                  async function processPublisherCreator(orm, editorId) {
                      const {PublisherRevision} = orm;
                      const rowCount = await getTypeCreation(new PublisherRevision(),
                          'publisher_revision',
                          editorId);
                  Severity: Major
                  Found in src/server/helpers/achievement.js and 5 other locations - About 3 hrs to fix
                  src/server/helpers/achievement.js on lines 238..257
                  src/server/helpers/achievement.js on lines 259..278
                  src/server/helpers/achievement.js on lines 280..301
                  src/server/helpers/achievement.js on lines 326..347
                  src/server/helpers/achievement.js on lines 349..370

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

                  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

                  async function processPublisher(orm, editorId) {
                      const {EditionGroupRevision} = orm;
                      const rowCount = await getTypeCreation(new EditionGroupRevision(),
                          'edition_group_revision',
                          editorId);
                  Severity: Major
                  Found in src/server/helpers/achievement.js and 5 other locations - About 3 hrs to fix
                  src/server/helpers/achievement.js on lines 238..257
                  src/server/helpers/achievement.js on lines 259..278
                  src/server/helpers/achievement.js on lines 303..324
                  src/server/helpers/achievement.js on lines 326..347
                  src/server/helpers/achievement.js on lines 349..370

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

                  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

                  async function processSeriesCreator(orm, editorId) {
                      const {SeriesRevision} = orm;
                      const rowCount = await getTypeCreation(new SeriesRevision(),
                          'series_revision',
                          editorId);
                  Severity: Major
                  Found in src/server/helpers/achievement.js and 5 other locations - About 3 hrs to fix
                  src/server/helpers/achievement.js on lines 238..257
                  src/server/helpers/achievement.js on lines 259..278
                  src/server/helpers/achievement.js on lines 280..301
                  src/server/helpers/achievement.js on lines 303..324
                  src/server/helpers/achievement.js on lines 326..347

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

                  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

                  async function processLimitedEdition(orm, editorId) {
                      const {EditionRevision} = orm;
                      const rowCount = await getTypeCreation(new EditionRevision(), 'edition_revision', editorId);
                      const tiers = [
                          {
                  Severity: Major
                  Found in src/server/helpers/achievement.js and 5 other locations - About 3 hrs to fix
                  src/server/helpers/achievement.js on lines 238..257
                  src/server/helpers/achievement.js on lines 280..301
                  src/server/helpers/achievement.js on lines 303..324
                  src/server/helpers/achievement.js on lines 326..347
                  src/server/helpers/achievement.js on lines 349..370

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

                  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

                  async function processAuthorCreator(orm, editorId) {
                      const {AuthorRevision} = orm;
                      const rowCount = await getTypeCreation(new AuthorRevision(), 'author_revision', editorId);
                      const tiers = [
                          {
                  Severity: Major
                  Found in src/server/helpers/achievement.js and 5 other locations - About 3 hrs to fix
                  src/server/helpers/achievement.js on lines 259..278
                  src/server/helpers/achievement.js on lines 280..301
                  src/server/helpers/achievement.js on lines 303..324
                  src/server/helpers/achievement.js on lines 326..347
                  src/server/helpers/achievement.js on lines 349..370

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

                  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