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

                    <thead>
                        <tr>
                            {authors[0].displayNumber && <th style={{width: '10%'}}>#</th>}
                            <th>Name</th>
                            <th>Gender</th>
Severity: Major
Found in src/client/components/pages/entities/author-table.js and 1 other location - About 5 hrs to fix
src/client/components/pages/entities/publisher-table.js on lines 86..98

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

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

    renderHeader() {
        return (
            <div>
                <Alert className="text-center" variant="warning">
                    Under development — adventurous users, please test and
Severity: Major
Found in src/client/components/pages/index.js - About 5 hrs to fix

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

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

      File layout.js has 399 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
       * Copyright (C) 2018  Theodore Fabian Rudy
       *                  2016  Daniel Hsing
       *                  2016  Ben Ockmore
       *                  2016  Sean Burke
      Severity: Minor
      Found in src/client/containers/layout.js - About 5 hrs to fix

        File entity.js has 394 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/server/helpers/diffFormatters/entity.js - About 5 hrs to fix

          Function processMergeOperation has 135 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export async function processMergeOperation(orm, transacting, session, mainEntity, allEntities, relationshipSets) {
              const {Edition, bookshelf} = orm;
              const {mergingEntities} = session.mergeQueue;
              if (!mergingEntities) {
                  throw new Error('Merge handler called with no merge queue, aborting');
          Severity: Major
          Found in src/server/routes/entity/entity.tsx - About 5 hrs to fix

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

                render() {
                    let messageComponent = null;
                    if (this.state.message.text) {
                        messageComponent = (
                            <div>
            Severity: Major
            Found in src/client/components/pages/parts/add-to-collection-modal.js - About 5 hrs to fix

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

                  render() {
                      const noResults = !this.props.results || this.props.results.length === 0;
              
                      const results = this.props.results.map((result) => {
                          if (!result) {
              Severity: Major
              Found in src/client/components/pages/parts/search-results.js - About 5 hrs to fix

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

                            <Row className="entity-display-background">
                                <Col className="entity-display-image-box text-center" lg={2}>
                                    <EntityImage
                                        backupIcon={ENTITY_TYPE_ICONS.Author}
                                        deleted={entity.deleted}
                Severity: Major
                Found in src/client/components/pages/entities/author.js and 2 other locations - About 5 hrs to fix
                src/client/components/pages/entities/series.js on lines 116..133
                src/client/components/pages/entities/work.js on lines 109..126

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 140.

                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

                            <Row className="entity-display-background">
                                <Col className="entity-display-image-box text-center" lg={2}>
                                    <EntityImage
                                        backupIcon={ENTITY_TYPE_ICONS.Work}
                                        deleted={entity.deleted}
                Severity: Major
                Found in src/client/components/pages/entities/work.js and 2 other locations - About 5 hrs to fix
                src/client/components/pages/entities/author.js on lines 142..159
                src/client/components/pages/entities/series.js on lines 116..133

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

                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

                            <Row className="entity-display-background">
                                <Col className="entity-display-image-box text-center" lg={2}>
                                    <EntityImage
                                        backupIcon={ENTITY_TYPE_ICONS.Series}
                                        deleted={entity.deleted}
                Severity: Major
                Found in src/client/components/pages/entities/series.js and 2 other locations - About 5 hrs to fix
                src/client/components/pages/entities/author.js on lines 142..159
                src/client/components/pages/entities/work.js on lines 109..126

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 140.

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

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

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

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

                Refactorings

                Further Reading

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

                                <Col lg={shortColSpan}>
                                    <NumericField
                                        addonAfter="mm"
                                        defaultValue={widthValue}
                                        disabled={!physicalEnable}
                Severity: Major
                Found in src/client/entity-editor/edition-section/edition-section.tsx and 1 other location - About 5 hrs to fix
                src/client/entity-editor/edition-section/edition-section.tsx on lines 465..484

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

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

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

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

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

                Refactorings

                Further Reading

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

                                <Col lg={3}>
                                    <NumericField
                                        addonAfter="g"
                                        defaultValue={weightValue}
                                        disabled={!physicalEnable}
                Severity: Major
                Found in src/client/entity-editor/edition-section/edition-section.tsx and 1 other location - About 5 hrs to fix
                src/client/entity-editor/edition-section/edition-section.tsx on lines 445..464

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

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

                    render() {
                        const messageComponent =
                            this.state.message.text ? (
                                <Alert
                                    className="margin-top-1"
                Severity: Major
                Found in src/client/components/pages/collection.js - About 5 hrs to fix

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

                      render() {
                          const {entity} = this.props;
                          const {note} = this.state;
                  
                          this.entityUrl = `/${_kebabCase(entity.type)}/${entity.bbid}`;
                  Severity: Major
                  Found in src/client/components/forms/deletion.js - About 5 hrs to fix

                    File identifier-type.tsx has 372 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /*
                     * Copyright (C) 2023 Shivam Awasthi
                     *
                     * 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/type-editor/identifier-type.tsx - About 4 hrs to fix

                      Function RelationshipTypeEditor has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function RelationshipTypeEditor({relationshipTypeData, parentTypes, attributeTypes}: RelationshipTypeEditorPropsT) {
                          const [formData, setFormData] = useState<RelationshipTypeDataT>(relationshipTypeData);
                      
                          // State for the ParentType modal
                          const [showModal, setShowModal] = useState<boolean>(false);
                      Severity: Minor
                      Found in src/client/components/forms/type-editor/relationship-type.tsx - About 4 hrs to fix

                      Cognitive Complexity

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

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

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

                      Further reading

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

                      router.get(
                          '/:bbid/edit', auth.isAuthenticated, auth.isAuthorized(ENTITY_EDITOR), middleware.loadIdentifierTypes,
                          middleware.loadPublisherTypes, middleware.loadLanguages,
                           middleware.loadEntityRelationships, middleware.loadRelationshipTypes,
                          (req, res) => {
                      Severity: Major
                      Found in src/server/routes/entity/publisher.ts and 3 other locations - About 4 hrs to fix
                      src/server/routes/entity/edition-group.ts on lines 345..361
                      src/server/routes/entity/series.ts on lines 328..344
                      src/server/routes/entity/work.ts on lines 348..364

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

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

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

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

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

                      Refactorings

                      Further Reading

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

                      router.get(
                          '/:bbid/edit', auth.isAuthenticated, auth.isAuthorized(ENTITY_EDITOR), middleware.loadIdentifierTypes,
                          middleware.loadWorkTypes, middleware.loadLanguages,
                           middleware.loadEntityRelationships, middleware.loadRelationshipTypes,
                          (req, res) => {
                      Severity: Major
                      Found in src/server/routes/entity/work.ts and 3 other locations - About 4 hrs to fix
                      src/server/routes/entity/edition-group.ts on lines 345..361
                      src/server/routes/entity/publisher.ts on lines 336..352
                      src/server/routes/entity/series.ts on lines 328..344

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

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

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

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

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

                      Refactorings

                      Further Reading

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

                      router.get(
                          '/:bbid/edit', auth.isAuthenticated, auth.isAuthorized(ENTITY_EDITOR), middleware.loadIdentifierTypes,
                          middleware.loadSeriesOrderingTypes, middleware.loadLanguages,
                           middleware.loadEntityRelationships, middleware.loadRelationshipTypes,
                          (req, res) => {
                      Severity: Major
                      Found in src/server/routes/entity/series.ts and 3 other locations - About 4 hrs to fix
                      src/server/routes/entity/edition-group.ts on lines 345..361
                      src/server/routes/entity/publisher.ts on lines 336..352
                      src/server/routes/entity/work.ts on lines 348..364

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

                      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