bookbrainz/bookbrainz-site

View on GitHub

Showing 1,033 of 1,033 total issues

File revision.js has 284 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (C) 2015-2016  Ben Ockmore
 *               2016       Sean Burke
 *
 * This program is free software; you can redistribute it and/or modify
Severity: Minor
Found in src/server/routes/revision.js - About 2 hrs to fix

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

        render() {
            const {mergeQueue} = this.props;
            if (isNil(mergeQueue)) {
                return null;
            }
    Severity: Major
    Found in src/client/components/pages/parts/merge-queue.js - About 2 hrs to fix

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

          render() {
              const [achievements, locked] = this.renderAchievements();
      
              let rankUpdate;
              if (this.props.isOwner) {
      Severity: Major
      Found in src/client/components/pages/parts/editor-achievements.js - About 2 hrs to fix

        Function seriesToFormState has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function seriesToFormState(series) {
            const aliases = series.aliasSet ?
                series.aliasSet.aliases.map(({languageId, ...rest}) => ({
                    ...rest,
                    language: languageId
        Severity: Major
        Found in src/server/routes/entity/series.ts - About 2 hrs to fix

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

                      <Row>
                          <Col lg={lgCol}>
                              <DateField
                                  show
                                  defaultValue={beginDateValue}
          Severity: Major
          Found in src/client/entity-editor/author-section/author-section.tsx and 1 other location - About 2 hrs to fix
          src/client/entity-editor/author-section/author-section.tsx on lines 252..264

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

          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 lg={lgCol}>
                                      <DateField
                                          show
                                          defaultValue={endDateValue}
          Severity: Major
          Found in src/client/entity-editor/author-section/author-section.tsx and 1 other location - About 2 hrs to fix
          src/client/entity-editor/author-section/author-section.tsx on lines 218..230

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

          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

              handleChange = event => {
                  if (!event.target.value.match(/^ +$/) && event.target.value !== this.state.query) {
                      this.setState({query: event.target.value}, this.debouncedTriggerOnSearch);
                  }
              };
          src/client/components/pages/parts/search-field.tsx on lines 106..110

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

          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

              handleChange = event => {
                  if (!event.target.value.match(/^ +$/) && event.target.value !== this.state.query) {
                      this.setState({query: event.target.value}, this.debouncedTriggerOnSearch);
                  }
              };
          Severity: Major
          Found in src/client/components/pages/parts/search-field.tsx and 1 other location - About 2 hrs to fix
          src/client/components/pages/parts/admin-panel-search-field.tsx on lines 93..97

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

          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 publisher.ts has 281 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
           * Copyright (C) 2015       Ben Ockmore
           *               2015-2016  Sean Burke
           *
           * This program is free software; you can redistribute it and/or modify
          Severity: Minor
          Found in src/server/routes/entity/publisher.ts - About 2 hrs to fix

            Function authorToFormState has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

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

                  render() {
                      const entityTypeSelect = Array.isArray(this.props.entityTypes) ? (
                          <DropdownButton
                              as={InputGroup.Append}
                              id="entity-type-select"
              Severity: Major
              Found in src/client/components/pages/parts/search-field.tsx - About 2 hrs to fix

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

                                <PagerElement
                                    from={this.props.from}
                                    nextEnabled={this.props.nextEnabled}
                                    paginationUrl={this.paginationUrl}
                                    results={this.state.results}
                Severity: Major
                Found in src/client/components/pages/entity-revisions.js and 2 other locations - About 2 hrs to fix
                src/client/components/pages/editor-revision.js on lines 50..57
                src/client/components/pages/revisions.js 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 89.

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

                                <PagerElement
                                    from={this.props.from}
                                    nextEnabled={this.props.nextEnabled}
                                    paginationUrl={this.paginationUrl}
                                    results={this.state.results}
                Severity: Major
                Found in src/client/components/pages/revisions.js and 2 other locations - About 2 hrs to fix
                src/client/components/pages/editor-revision.js on lines 50..57
                src/client/components/pages/entity-revisions.js on lines 91..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 89.

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

                                <PagerElement
                                    from={this.props.from}
                                    nextEnabled={this.props.nextEnabled}
                                    paginationUrl={this.paginationUrl}
                                    results={this.state.results}
                Severity: Major
                Found in src/client/components/pages/editor-revision.js and 2 other locations - About 2 hrs to fix
                src/client/components/pages/entity-revisions.js on lines 91..98
                src/client/components/pages/revisions.js 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 89.

                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

                                                {!formData.parentId ? (
                                                    <Row className="margin-top-1">
                                                        <Col
                                                            className="text-center"
                                                        >
                Severity: Major
                Found in src/client/components/forms/type-editor/identifier-type.tsx and 1 other location - About 2 hrs to fix
                src/client/components/forms/type-editor/relationship-type.tsx on lines 360..403

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

                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

                function RelationshipSection({
                    canEdit, entity, entityType, entityName, languageOptions, showEditor, relationships,
                    relationshipEditorProps, relationshipTypes, onAddRelationship,
                    onEditorClose, onEditorAdd, onEdit, onRemove, onUndo, undoPossible
                }: Props) {
                src/client/entity-editor/series-section/series-section.tsx on lines 100..245

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

                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

                                                {!formData.parentId ? (
                                                    <Row className="margin-top-1">
                                                        <Col
                                                            className="text-center"
                                                        >
                src/client/components/forms/type-editor/identifier-type.tsx on lines 304..345

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

                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

                function SeriesSection({
                    entity,
                    entityName,
                    entityType,
                    hideItemSelect,
                Severity: Major
                Found in src/client/entity-editor/series-section/series-section.tsx and 1 other location - About 2 hrs to fix
                src/client/entity-editor/relationship-editor/relationship-section.tsx on lines 148..244

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

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

                    render() {
                        let reviewContent;
                        const mapEntityType = {
                            Author: 'author',
                            EditionGroup: 'edition-group',
                Severity: Major
                Found in src/client/components/pages/entities/cb-review.js - About 2 hrs to fix

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

                          async function render(props) {
                              const {initialState} = props;
                              initialState.nameSection = {
                                  disambiguation: '',
                                  exactMatches: null,
                  Severity: Major
                  Found in src/server/routes/entity/edition.ts - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language