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

EditionGroupTableRow.propTypes = {
    editionGroup: PropTypes.object.isRequired,
    onToggleRow: PropTypes.func,
    selectedEntities: PropTypes.array,
    showAddedAtColumn: PropTypes.bool.isRequired,
Severity: Major
Found in src/client/components/pages/entities/editionGroup-table.js and 1 other location - About 1 hr to fix
src/client/components/pages/entities/series.js on lines 182..188

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

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

export class NotAuthorizedError extends PathError {
    static get defaultMessage() {
        return 'You do not have permission to access this route';
    }

Severity: Major
Found in src/common/helpers/error.js and 1 other location - About 1 hr to fix
src/common/helpers/error.js on lines 93..108

Duplicated Code

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

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

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

Tuning

This issue has a mass of 65.

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

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

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

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

Refactorings

Further Reading

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

    const languages = _.flatMap(entities, entity => _.get(entity, 'languageSet.languages', []).map(
        ({id, name}) => ({label: name, value: id})
    ));
Severity: Major
Found in src/server/helpers/merge.js and 1 other location - About 1 hr to fix
src/server/helpers/merge.js on lines 127..129

Duplicated Code

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

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

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

Tuning

This issue has a mass of 65.

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

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

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

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

Refactorings

Further Reading

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

const markup = (
    <AppContainer>
        <Layout {...extractLayoutProps(rest)}>
            <Provider store={store}>
                {getEntityEditor()}
Severity: Major
Found in src/client/entity-editor/controller.js and 1 other location - About 1 hr to fix
src/client/unified-form/controller.js on lines 45..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 65.

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

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

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

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

Refactorings

Further Reading

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

    const languages = _.flatMap(entities, entity => _.get(entity, 'languageSet.languages', []).map(
        ({id, name}) => ({label: name, value: id})
    ));
Severity: Major
Found in src/server/helpers/merge.js and 1 other location - About 1 hr to fix
src/server/helpers/merge.js on lines 214..216

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

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

export class NotFoundError extends PathError {
    static get defaultMessage() {
        return 'Page not found';
    }

Severity: Major
Found in src/common/helpers/error.js and 1 other location - About 1 hr to fix
src/common/helpers/error.js on lines 129..145

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

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

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

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

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

Refactorings

Further Reading

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

const markup = (
    <AppContainer>
        <Layout {...extractLayoutProps(rest)}>
            <Provider store={store}>
                {getEntityEditor()}
Severity: Major
Found in src/client/unified-form/controller.js and 1 other location - About 1 hr to fix
src/client/entity-editor/controller.js on lines 85..93

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

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

export function getValidator(entityType: string) {
    const VALIDATOR_MAP = {
        author: validateAuthorForm,
        edition: validateEditionForm,
        editionGroup: validateEditionGroupForm,
Severity: Major
Found in src/client/entity-editor/helpers.ts and 1 other location - About 1 hr to fix
src/client/entity-editor/helpers.ts on lines 73..84

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

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

export function getEntitySection(entityType: string) {
    const SECTION_MAP = {
        author: AuthorSection,
        edition: EditionSection,
        editionGroup: EditionGroupSection,
Severity: Major
Found in src/client/entity-editor/helpers.ts and 1 other location - About 1 hr to fix
src/client/entity-editor/helpers.ts on lines 112..123

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

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

    async handleAddToCollection() {
        const {bbids} = this.props;
        const {selectedCollections} = this.state;
        if (selectedCollections.length) {
            try {
Severity: Minor
Found in src/client/components/pages/parts/add-to-collection-modal.js - About 1 hr to fix

    Function formatChange has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        static formatChange(change) {
            const isChangeADate = change.key.toLowerCase().match(/\bdate\b/);
            if (change.kind === 'N') {
                return (
                    <tr className="table-success" key={change.key}>
    Severity: Minor
    Found in src/client/components/pages/revision.js - About 1 hr to fix

      Function renderContent has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          renderContent() {
              return (
                  <Container>
                      <Row>
                          <Col lg={{offset: 2, span: 8}}>
      Severity: Minor
      Found in src/client/components/pages/index.js - About 1 hr to fix

        Function ErrorPage has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function ErrorPage(props) {
            const {error} = props;
            let {detailedMessage} = error;
        
            if (typeof detailedMessage === 'string') {
        Severity: Minor
        Found in src/client/components/pages/error.js - About 1 hr to fix

          Function fetchOptions has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              async fetchOptions(query) {
                  if (!query) {
                      return {
                          options: []
                      };
          Severity: Minor
          Found in src/client/entity-editor/common/entity-search-field-option.js - About 1 hr to fix

            Function getChangedProps has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export async function getChangedProps(
                orm, transacting, isNew, currentEntity, body, entityType,
                newRevision, derivedProps
            ) {
                const aliasSetPromise =
            Severity: Minor
            Found in src/server/routes/entity/entity.tsx - About 1 hr to fix

              Function parseInitialState has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export async function parseInitialState(req, type):Promise<Record<string, any>> {
                  const emptyState = {
                      nameSection: {
                          disambiguation: '',
                          exactMatches: null,
              Severity: Minor
              Found in src/server/helpers/utils.ts - About 1 hr to fix

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

                    render() {
                        const hasPermissions = this.accessToken !== null;
                        const modalBody = this.getModalBody(hasPermissions);
                        const modalFooter = this.getModalFooter(hasPermissions);
                
                
                Severity: Minor
                Found in src/client/components/pages/entities/cbReviewModal.tsx - About 1 hr to fix

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

                  const markup = (
                      <AppContainer>
                          <Layout {...extractLayoutProps(props)}>
                              <SearchPage
                                  user={props.user}
                  Severity: Major
                  Found in src/client/controllers/search.js and 2 other locations - About 1 hr to fix
                  src/client/controllers/admin-panel.js on lines 30..39
                  src/client/controllers/externalService.js on lines 30..39

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

                  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

                  const markup = (
                      <AppContainer>
                          <Layout {...extractLayoutProps(props)}>
                              <ExternalServices
                                  cbPermission={props.cbPermission}
                  Severity: Major
                  Found in src/client/controllers/externalService.js and 2 other locations - About 1 hr to fix
                  src/client/controllers/admin-panel.js on lines 30..39
                  src/client/controllers/search.js on lines 30..39

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

                  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

                  const markup = (
                      <AppContainer>
                          <Layout {...extractLayoutProps(props)}>
                              <AdminPanelSearchPage
                                  user={props.user}
                  Severity: Major
                  Found in src/client/controllers/admin-panel.js and 2 other locations - About 1 hr to fix
                  src/client/controllers/externalService.js on lines 30..39
                  src/client/controllers/search.js on lines 30..39

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

                  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