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

                <Col lg={2}>
                    <dl>
                        <dt>Total Items</dt>
                        <dd>{series.seriesItems.length}</dd>
                    </dl>
Severity: Major
Found in src/client/components/pages/entities/series.js and 1 other location - About 1 hr to fix
src/client/components/pages/entities/series.js on lines 61..66

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

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

function formatAliasModified(change) {
    if (change.path.length > 3 && change.path[3] === 'name') {
        return [
            base.formatChange(
                change,
Severity: Minor
Found in src/server/helpers/diffFormatters/entity.js - About 1 hr to fix

    Function promises has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            async (revision) => {
                const dataId = revision.get('dataId');
                const revisionEntity = revision.related('entity');
                const entityBBID = revisionEntity.get('bbid');
                const entity = await orm.func.entity.getEntity(orm, entityType, entityBBID);
    Severity: Minor
    Found in src/server/routes/revision.js - About 1 hr to fix

      Function handleAddToNewCollection has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          handleAddToNewCollection(evt) {
              evt.preventDefault();
      
              if (!this.isValid()) {
                  this.setState({
      Severity: Minor
      Found in src/client/components/pages/parts/add-to-collection-modal.js - About 1 hr to fix

        Function generateRelationshipSelection has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function generateRelationshipSelection(
            relationshipTypes: Array<RelationshipType>,
            entityA: Entity,
            entityB: Entity
        ): Array<RelationshipWithLabel> {

          Function alertPromise has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              let alertPromise = editorEntityVisitPromise.then((visitAlert) => {
                  let alertIds = [];
                  if (visitAlert.alert) {
                      alertIds = alertIds.concat(visitAlert.alert.split(',').map(
                          (id) => parseInt(id, 10)
          Severity: Minor
          Found in src/server/routes/entity/entity.tsx - About 1 hr to fix

            Function SearchEntityCreate has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function SearchEntityCreate(props:SearchEntityCreateProps) {
                const {type, nextId, onModalOpen, onModalClose, onSubmitEntity, rowId, onOpenCallback, ...rest} = props;
                const createLabel = React.useCallback((input) => `Create ${type} "${input}"`, [type]);
                const [showModal, setShowModal] = React.useState(false);
                const getNewOptionData = React.useCallback((_, label) => ({
            Severity: Minor
            Found in src/client/unified-form/common/search-entity-create-select.tsx - About 1 hr to fix

              Function getEntityFetchPropertiesByType has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function getEntityFetchPropertiesByType(entityType) {
                  switch (entityType) {
                      case 'Author':
                          return ['authorType', 'beginArea', 'endArea', 'gender'];
                      case 'Edition':
              Severity: Minor
              Found in src/server/helpers/merge.js - About 1 hr to fix

                Function identifierTypeCreateOrEditHandler has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export async function identifierTypeCreateOrEditHandler(req, res) {
                    try {
                        const {IdentifierType} = req.app.locals.orm;
                        let newIdentifierType;
                        let method;
                Severity: Minor
                Found in src/server/helpers/typeRouteUtils.ts - About 1 hr to fix

                  Function getAssociatedEntityRevisions has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export async function getAssociatedEntityRevisions(revisions, orm) {
                      const revisionIDs = revisions.map(({revisionId}) => revisionId);
                      const RevisionModels = getRevisionModels(orm);
                      const {Entity} = orm;
                      for (let i = 0; i < RevisionModels.length; i++) {
                  Severity: Minor
                  Found in src/server/helpers/revisions.ts - About 1 hr to fix

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

                                            <InputGroup.Append style={{'margin-right': '-1px'}}>
                                                <InputGroup.Text style={{padding: '0 0.5em'}}>-</InputGroup.Text>
                                            </InputGroup.Append>
                    Severity: Major
                    Found in src/client/entity-editor/common/new-date-field.js and 1 other location - About 1 hr to fix
                    src/client/entity-editor/common/new-date-field.js on lines 151..153

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 67.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                            <InputGroup.Append style={{'margin-right': '-1px'}}>
                                                <InputGroup.Text style={{padding: '0 0.5em'}}>-</InputGroup.Text>
                                            </InputGroup.Append>
                    Severity: Major
                    Found in src/client/entity-editor/common/new-date-field.js and 1 other location - About 1 hr to fix
                    src/client/entity-editor/common/new-date-field.js on lines 163..165

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 67.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                        entityAlias: dataId ?
                                            revision.related('data').fetch({require: false, withRelated: ['aliasSet.defaultAlias', 'aliasSet.aliases']}) :
                                            orm.func.entity.getEntityParentAlias(
                                                orm, entityType, revision.get('bbid')
                                            ),
                    Severity: Major
                    Found in src/server/routes/revision.js and 1 other location - About 1 hr to fix
                    src/server/routes/revision.js on lines 215..219

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 67.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                        entityAlias: dataId ?
                                            revision.related('data').fetch({require: false, withRelated: ['aliasSet.defaultAlias', 'aliasSet.aliases']}) :
                                            orm.func.entity.getEntityParentAlias(
                                                orm, entityType, revision.get('bbid')
                                            ),
                    Severity: Major
                    Found in src/server/routes/revision.js and 1 other location - About 1 hr to fix
                    src/server/routes/revision.js on lines 199..203

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 67.

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

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

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

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

                    Refactorings

                    Further Reading

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

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

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 67.

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

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

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

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

                    Refactorings

                    Further Reading

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

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

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 67.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                const markup = ReactDOMServer.renderToString(
                                    <Layout {...propHelpers.extractLayoutProps(props)}>
                                        <RelationshipTypeEditor
                                            relationshipTypeData={props.relationshipTypeData}
                                            {...propHelpers.extractChildProps(props)}
                    Severity: Major
                    Found in src/server/routes/type-editor/relationship-type.tsx and 4 other locations - About 1 hr to fix
                    src/server/routes/adminPanel.tsx on lines 84..91
                    src/server/routes/entity/entity.tsx on lines 215..222
                    src/server/routes/search.tsx on lines 84..91
                    src/server/routes/type-editor/identifier-type.tsx on lines 78..85

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 67.

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

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

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

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

                    Refactorings

                    Further Reading

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

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

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 67.

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

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

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

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

                    Refactorings

                    Further Reading

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

                            const markup = ReactDOMServer.renderToString(
                                <Layout {...propHelpers.extractLayoutProps(props)}>
                                    <AdminPanelSearchPage
                                        user={props.user}
                                        {...propHelpers.extractChildProps(props)}
                    Severity: Major
                    Found in src/server/routes/adminPanel.tsx and 4 other locations - About 1 hr to fix
                    src/server/routes/entity/entity.tsx on lines 215..222
                    src/server/routes/search.tsx on lines 84..91
                    src/server/routes/type-editor/identifier-type.tsx on lines 78..85
                    src/server/routes/type-editor/relationship-type.tsx on lines 83..90

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 67.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                const markup = ReactDOMServer.renderToString(
                                    <Layout {...propHelpers.extractLayoutProps(props)}>
                                        <IdentifierTypeEditor
                                            identifierTypeData={props.identifierTypeData}
                                            {...propHelpers.extractChildProps(props)}
                    Severity: Major
                    Found in src/server/routes/type-editor/identifier-type.tsx and 4 other locations - About 1 hr to fix
                    src/server/routes/adminPanel.tsx on lines 84..91
                    src/server/routes/entity/entity.tsx on lines 215..222
                    src/server/routes/search.tsx on lines 84..91
                    src/server/routes/type-editor/relationship-type.tsx on lines 83..90

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 67.

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

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

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

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

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language