superdesk/superdesk-client-core

View on GitHub
scripts/apps/search/components/SmoothLoader.tsx

Summary

Maintainability
A
2 hrs
Test Coverage

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

    render() {
        const {loading, children} = this.props;
        const style: CSSProperties = loading
            ? {position: 'absolute', insetInlineStart: -9999, insetBlockStart: -9999, visibility: 'hidden'}
            : {height: '100%'};
Severity: Minor
Found in scripts/apps/search/components/SmoothLoader.tsx - About 1 hr to fix

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

            const style: CSSProperties = loading
                ? {position: 'absolute', insetInlineStart: -9999, insetBlockStart: -9999, visibility: 'hidden'}
                : {height: '100%'};
    Severity: Minor
    Found in scripts/apps/search/components/SmoothLoader.tsx and 1 other location - About 45 mins to fix
    scripts/apps/search/components/SmoothLoaderForKey.tsx on lines 50..52

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

    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

        saveSnapshot() {
            if (this.props.loading !== true) {
                this.lastSnapshotHtml = this.wrapper.innerHTML;
            }
        }
    Severity: Minor
    Found in scripts/apps/search/components/SmoothLoader.tsx and 1 other location - About 35 mins to fix
    scripts/apps/search/components/SmoothLoaderOuter.tsx on lines 22..26

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

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

        constructor(props: IProps) {
            super(props);
    
            this.saveSnapshot = this.saveSnapshot.bind(this);
        }
    Severity: Major
    Found in scripts/apps/search/components/SmoothLoader.tsx and 16 other locations - About 30 mins to fix
    scripts/apps/authoring-react/fields/date/config.tsx on lines 9..13
    scripts/apps/authoring-react/fields/media/media-carousel/image.tsx on lines 24..28
    scripts/apps/authoring-react/fields/urls/editor.tsx on lines 16..20
    scripts/apps/authoring-react/with-keybindings.tsx on lines 9..13
    scripts/apps/desks/components/MarkBtn.tsx on lines 11..15
    scripts/apps/search/components/SelectBox.tsx on lines 45..49
    scripts/apps/search/components/SmoothLoaderOuter.tsx on lines 16..20
    scripts/core/helpers/with-popover.tsx on lines 17..21
    scripts/core/interactive-article-actions-panel/actions/send-correction-tab.tsx on lines 19..23
    scripts/extensions/broadcasting/src/authoring-fields/subitems/subitems-view-edit.tsx on lines 29..33
    scripts/extensions/sams/src/components/assets/assetTypeFilterButtons.tsx on lines 37..41
    scripts/extensions/sams/src/components/sets/manageSetsModal.tsx on lines 54..58
    scripts/extensions/sams/src/ui/grid/GridItem.tsx on lines 16..20
    scripts/extensions/sams/src/ui/list/ListItem.tsx on lines 25..29
    scripts/extensions/sams/src/ui/modal/Modal.tsx on lines 17..21
    scripts/core/with-resources.tsx on lines 226..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 45.

    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

    There are no issues that match your filters.

    Category
    Status