bookbrainz/bookbrainz-site

View on GitHub

Showing 1,033 of 1,033 total issues

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

    const aliases = author.aliasSet ?
        author.aliasSet.aliases.map(({languageId, ...rest}) => ({
            ...rest,
            language: languageId
        })) : [];
Severity: Major
Found in src/server/routes/entity/author.ts and 4 other locations - About 1 hr to fix
src/server/routes/entity/edition-group.ts on lines 246..250
src/server/routes/entity/edition.ts on lines 411..415
src/server/routes/entity/publisher.ts on lines 258..262
src/server/routes/entity/work.ts on lines 270..274

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

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

        languages: work.languageSet ? work.languageSet.languages.map(
            ({id, name}) => ({label: name, value: id})
        ) : [],
Severity: Major
Found in src/server/routes/entity/work.ts and 1 other location - About 1 hr to fix
src/server/routes/entity/edition.ts on lines 493..495

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

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

        languages: edition.languageSet ? edition.languageSet.languages.map(
            ({id, name}) => ({label: name, value: id})
        ) : [],
Severity: Major
Found in src/server/routes/entity/edition.ts and 1 other location - About 1 hr to fix
src/server/routes/entity/work.ts on lines 307..309

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

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 processSingleEntity has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

export async function processSingleEntity(formBody, JSONEntity, reqSession,
    entityType, orm:any, editorJSON, derivedProps, isMergeOperation, transacting):Promise<any> {
Severity: Major
Found in src/server/routes/entity/entity.tsx - About 1 hr to fix

    Function CallToAction has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function CallToAction(props) {
        const seedingParameters = new URLSearchParams({name: props.query});
        function renderEntityLink(type) {
            return (
                <a href={`/${camelCase(type)}/create?${seedingParameters}`}>
    Severity: Minor
    Found in src/client/components/pages/parts/call-to-action.js - About 1 hr to fix

      Function createRootReducer has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function createRootReducer() {
          return (state: Immutable.Map<string, any>, action) => {
              // first pass the state to our cross slice reducer to handle UF specific actions.
              const intermediateState = crossSliceReducer(state, action);
              return combineReducers({
      Severity: Minor
      Found in src/client/unified-form/helpers.ts - About 1 hr to fix

        Function results has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                const results = this.props.results.map((result) => {
                    if (!result) {
                        return null;
                    }
                    const name = result.defaultAlias ? result.defaultAlias.name :
        Severity: Minor
        Found in src/client/components/pages/parts/admin-panel-search-results.tsx - About 1 hr to fix

          Function mapDispatchToProps has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function mapDispatchToProps(dispatch: Dispatch<Action>): DispatchProps {
              return {
                  onAuthorCreditChange: (selectedAuthorCredit:AuthorCredit) => {
                      dispatch(updateAuthorCredit(selectedAuthorCredit));
                  },
          Severity: Minor
          Found in src/client/entity-editor/edition-section/edition-section-merge.tsx - About 1 hr to fix

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

            const markup = (
                <AppContainer>
                    <Layout {...extractLayoutProps(props)}>
                        <DeletionForm entity={props.entity}/>
                    </Layout>
            Severity: Major
            Found in src/client/controllers/deletion.js and 1 other location - About 1 hr to fix
            src/client/controllers/error.js on lines 29..37

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

            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

                return (type) => {
                    let rowCountPromise;
                    if (type === revisionType) {
                        rowCountPromise = Promise.resolve(rowcount);
                    }
            Severity: Major
            Found in data/test-data.js and 1 other location - About 1 hr to fix
            data/test-data.js on lines 540..549

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

            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(props)}>
                        <ErrorPage
                            error={props.error}
            Severity: Major
            Found in src/client/controllers/error.js and 1 other location - About 1 hr to fix
            src/client/controllers/deletion.js on lines 30..36

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

            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={lgCol}>
                                    <SortNameField
                                        defaultValue={sortNameValue}
                                        empty={isAliasEmpty(
                                            nameValue, sortNameValue, languageValue
            Severity: Major
            Found in src/client/entity-editor/name-section/name-section.js and 1 other location - About 1 hr to fix
            src/client/entity-editor/alias-editor/alias-row.js on lines 91..101

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

            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

                        await new UserCollectionItem()
                            .query((qb) => {
                                qb.where('collection_id', collection.id);
                                qb.whereIn('bbid', bbids);
                            }).destroy();
            Severity: Major
            Found in src/server/routes/collection.js and 1 other location - About 1 hr to fix
            src/server/routes/collection.js on lines 337..341

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

            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

                        await new UserCollectionCollaborator()
                            .query((qb) => {
                                qb.where('collection_id', collection.id);
                                qb.whereIn('collaborator_id', collaboratorIdsToRemove);
                            }).destroy();
            Severity: Major
            Found in src/server/routes/collection.js and 1 other location - About 1 hr to fix
            src/server/routes/collection.js on lines 261..265

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

            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

                return (type, string) => {
                    let rowCountPromise;
                    if (string === revisionTypeString) {
                        rowCountPromise = Promise.resolve(rowCount);
                    }
            Severity: Major
            Found in data/test-data.js and 1 other location - About 1 hr to fix
            data/test-data.js on lines 527..536

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

            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={4}>
                            <SortNameField
                                defaultValue={sortNameValue}
                                empty={
                                    isAliasEmpty(nameValue, sortNameValue, languageValue)
            Severity: Major
            Found in src/client/entity-editor/alias-editor/alias-row.js and 1 other location - About 1 hr to fix
            src/client/entity-editor/name-section/name-section.js on lines 239..249

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

            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

                switch (type) {
                    case ADD_EDITION_GROUP:
                        return state.set(payload.id, Immutable.fromJS(payload.value));
                    case CLEAR_EDITION_GROUPS:
                        return Immutable.Map({});
            Severity: Major
            Found in src/client/unified-form/detail-tab/reducer.ts and 1 other location - About 1 hr to fix
            src/client/unified-form/helpers.ts on lines 39..46

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

            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

                                relationship.sourceEntity = {
                                    bbid: relationship.source.bbid,
                                    defaultAlias: {
                                        name: relationship.source.name
                                    },
            Severity: Major
            Found in src/client/unified-form/helpers.ts and 1 other location - About 1 hr to fix
            src/client/unified-form/helpers.ts on lines 200..206

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

            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

                switch (type) {
                    case DUMP_EDITION:
                        return state.set(payload.id, Immutable.fromJS(payload.value));
                    case LOAD_EDITION:
                        return Immutable.Map({});
            Severity: Major
            Found in src/client/unified-form/helpers.ts and 1 other location - About 1 hr to fix
            src/client/unified-form/detail-tab/reducer.ts on lines 6..13

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

            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

                                relationship.targetEntity = {
                                    bbid: relationship.target.bbid,
                                    defaultAlias: {
                                        name: relationship.target.name
                                    },
            Severity: Major
            Found in src/client/unified-form/helpers.ts and 1 other location - About 1 hr to fix
            src/client/unified-form/helpers.ts on lines 193..199

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

            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