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

                    this.state.message.text ?
                        <Alert
                            className="margin-top-1"
                            variant={this.state.message.type}
                            onDismiss={this.handleAlertDismiss}
Severity: Major
Found in src/client/components/pages/parts/search-results.js and 1 other location - About 2 hrs to fix
src/client/components/pages/collection.js on lines 205..213

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

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

                        <Button
                            className="footer-button"
                            disabled={this.props.deleted}
                            href={`${this.props.entityUrl}/edit`}
                            title="Edit Entity"
Severity: Major
Found in src/client/components/pages/entities/footer.js and 1 other location - About 2 hrs to fix
src/client/components/pages/entities/footer.js on lines 121..130

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

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

                        <Button
                            className="footer-button"
                            disabled={this.props.deleted}
                            href={`${this.props.entityUrl}/delete`}
                            title="Delete Entity"
Severity: Major
Found in src/client/components/pages/entities/footer.js and 1 other location - About 2 hrs to fix
src/client/components/pages/entities/footer.js on lines 102..111

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

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

            this.state.message.text ? (
                <Alert
                    className="margin-top-1"
                    variant={this.state.message.type}
                    onDismiss={this.handleAlertDismiss}
Severity: Major
Found in src/client/components/pages/collection.js and 1 other location - About 2 hrs to fix
src/client/components/pages/parts/search-results.js on lines 257..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 81.

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

export async function collectionCreateOrEditHandler(req, res, next) {
    try {
        const {UserCollection, UserCollectionCollaborator} = req.app.locals.orm;
        const isNew = !res.locals.collection;
        let newCollection;
Severity: Major
Found in src/server/helpers/collectionRouteUtils.js - About 2 hrs to fix

    Function transformNewForm has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function transformNewForm(data) {
        const aliases = entityRoutes.constructAliases(
            data.aliasEditor, data.nameSection
        );
    
    
    Severity: Major
    Found in src/server/routes/entity/edition.ts - About 2 hrs to fix

      Function getProgress has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function getProgress(achievementId, editorId, orm) {
          const revisionist = [1, 2, 3];
          if (revisionist.includes(achievementId)) {
              const {Editor} = orm;
              const editor = await new Editor({id: editorId})
      Severity: Major
      Found in src/server/routes/editor.tsx - About 2 hrs to fix

        Function render has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

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

        Cognitive Complexity

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

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

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

        Further reading

        Function SeriesEditor has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        function SeriesEditor({baseEntity, relationshipTypes, seriesType, orderType, onRemove, hideItemSelect,
            onAdd, onEdit, onSort, seriesItemsArray, isUnifiedForm}:SeriesItemsProps) {
            const [seriesItem, setSeriesItem] = useState(null);
            const [targetEntity, setTargetEntity] = useState(null);
        
        
        Severity: Minor
        Found in src/client/entity-editor/series-section/series-editor.tsx - About 2 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

        Function mapDispatchToProps has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        function mapDispatchToProps(dispatch: Dispatch<Action>): DispatchProps {
            return {
                onDepthChange: (event) => dispatch(debouncedUpdateDepth(
                    event.target.value ? parseInt(event.target.value, 10) : null
                )),
        Severity: Minor
        Found in src/client/entity-editor/edition-section/edition-section.tsx - About 2 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

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

                            <Button
                                disabled={isNil(this.state.selectedOption)}
                                href={`/merge/submit/${this.state.selectedOption}`}
                                title="Merge entities"
                                variant="success"
        Severity: Major
        Found in src/client/components/pages/parts/merge-queue.js and 1 other location - About 2 hrs to fix
        src/client/components/pages/parts/merge-queue.js on lines 108..116

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

        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

                            <tbody>
                                {
                                    publishers.map((publisher) => (
                                        <PublisherTableRow
                                            key={publisher.bbid}
        Severity: Major
        Found in src/client/components/pages/entities/publisher-table.js and 2 other locations - About 2 hrs to fix
        src/client/components/pages/entities/series-table.js on lines 90..103
        src/client/components/pages/entities/work-table.js on lines 107..120

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

        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

                            <tbody>
                                {
                                    series.map((entity) => (
                                        <SeriesTableRow
                                            key={entity.bbid}
        Severity: Major
        Found in src/client/components/pages/entities/series-table.js and 2 other locations - About 2 hrs to fix
        src/client/components/pages/entities/publisher-table.js on lines 99..112
        src/client/components/pages/entities/work-table.js on lines 107..120

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

        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

                            <tbody>
                                {
                                    works.map((work) => (
                                        <WorkTableRow
                                            key={work.bbid}
        Severity: Major
        Found in src/client/components/pages/entities/work-table.js and 2 other locations - About 2 hrs to fix
        src/client/components/pages/entities/publisher-table.js on lines 99..112
        src/client/components/pages/entities/series-table.js on lines 90..103

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

        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

                            <Button
                                disabled={isNil(this.state.selectedOption)}
                                href={`/merge/remove/${this.state.selectedOption}`}
                                title="Remove from merge"
                                variant="warning"
        Severity: Major
        Found in src/client/components/pages/parts/merge-queue.js and 1 other location - About 2 hrs to fix
        src/client/components/pages/parts/merge-queue.js on lines 99..107

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

        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

            for (let i = 0; i < bbids.length; i++) {
                const bbid = bbids[i];
                if (!commonUtils.isValidBBID(bbid)) {
                    return next(new error.BadRequestError(`Invalid BBID ${bbid}`, req));
                }
        Severity: Major
        Found in src/server/helpers/middleware.ts and 1 other location - About 2 hrs to fix
        src/server/helpers/middleware.ts on lines 421..426

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

        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 = ReactDOMServer.renderToString(
                    <Layout {...propHelpers.extractLayoutProps(props)}>
                        <EditorContainer
                            {...propHelpers.extractEditorProps(props)}
                        >
        Severity: Major
        Found in src/server/routes/editor.tsx and 1 other location - About 2 hrs to fix
        src/server/routes/editor.tsx on lines 389..399

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

        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

            for (let i = 0; i < bbids.length; i++) {
                const bbid = bbids[i];
                if (!commonUtils.isValidBBID(bbid)) {
                    return next(new error.BadRequestError(`Invalid BBID ${bbid}`, req));
                }
        Severity: Major
        Found in src/server/helpers/middleware.ts and 1 other location - About 2 hrs to fix
        src/server/helpers/middleware.ts on lines 393..398

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

        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 = ReactDOMServer.renderToString(
                    <Layout {...propHelpers.extractLayoutProps(props)}>
                        <EditorContainer
                            {...propHelpers.extractEditorProps(props)}
                        >
        Severity: Major
        Found in src/server/routes/editor.tsx and 1 other location - About 2 hrs to fix
        src/server/routes/editor.tsx on lines 671..681

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

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

        import {ADD_AUTHOR, ADD_PUBLISHER} from './cover-tab/action';
        import {Action, State} from './interface/type';
        import {CLOSE_ENTITY_MODAL, DUMP_EDITION, LOAD_EDITION, OPEN_ENTITY_MODAL} from './action';
        import {ISBNReducer, authorsReducer, autoISBNReducer, publishersReducer} from './cover-tab/reducer';
        import {seriesReducer, worksReducer} from './content-tab/reducer';
        Severity: Minor
        Found in src/client/unified-form/helpers.ts - About 2 hrs to fix
          Severity
          Category
          Status
          Source
          Language