appbaseio/reactivesearch

View on GitHub
packages/native/src/components/list/SingleDropdownList.js

Summary

Maintainability
F
3 days
Test Coverage

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

    render() {
        let selectAll = [];

        if (this.state.options.length === 0) {
            return null;
Severity: Major
Found in packages/native/src/components/list/SingleDropdownList.js - About 2 hrs to fix

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

        componentDidMount() {
            this.props.addComponent(this.internalComponent);
            this.props.addComponent(this.props.componentId);
            this.updateQueryOptions(this.props);
    
    
    Severity: Major
    Found in packages/native/src/components/list/SingleDropdownList.js and 2 other locations - About 5 hrs to fix
    packages/web/src/components/list/SingleDropdownList.js on lines 44..56
    packages/web/src/components/list/SingleList.js on lines 51..63

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

    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 mapDispatchtoProps = dispatch => ({
        addComponent: component => dispatch(addComponent(component)),
        removeComponent: component => dispatch(removeComponent(component)),
        watchComponent: (component, react) => dispatch(watchComponent(component, react)),
        updateQuery: updateQueryObject => dispatch(updateQuery(updateQueryObject)),
    Severity: Major
    Found in packages/native/src/components/list/SingleDropdownList.js and 2 other locations - About 4 hrs to fix
    packages/native/src/components/list/MultiDropdownList.js on lines 413..421
    packages/native/src/components/search/DataSearch.js on lines 653..661

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

    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

        updateQueryOptions = (props) => {
            const queryOptions = getQueryOptions(props);
            queryOptions.size = 0;
            queryOptions.aggs = {
                [props.dataField]: {
    Severity: Major
    Found in packages/native/src/components/list/SingleDropdownList.js and 1 other location - About 3 hrs to fix
    packages/native/src/components/list/MultiDropdownList.js on lines 230..243

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

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

        setReact = (props) => {
            const { react } = props;
            if (react) {
                const newReact = pushToAndClause(react, this.internalComponent);
                props.watchComponent(props.componentId, newReact);
    Severity: Major
    Found in packages/native/src/components/list/SingleDropdownList.js and 14 other locations - About 2 hrs to fix
    packages/maps-native/src/components/maps/ReactiveMap.js on lines 215..223
    packages/maps/src/components/result/ReactiveMap.js on lines 350..358
    packages/native/src/components/list/MultiDropdownList.js on lines 99..107
    packages/native/src/components/range/RangeSlider.js on lines 110..118
    packages/native/src/components/result/ReactiveList.js on lines 241..249
    packages/native/src/components/search/DataSearch.js on lines 108..116
    packages/web/src/components/basic/TagCloud.js on lines 97..107
    packages/web/src/components/list/MultiDropdownList.js on lines 123..133
    packages/web/src/components/list/MultiList.js on lines 117..127
    packages/web/src/components/list/SingleDropdownList.js on lines 112..122
    packages/web/src/components/list/SingleList.js on lines 108..118
    packages/web/src/components/range/RangeSlider.js on lines 115..125
    packages/web/src/components/search/CategorySearch.js on lines 144..154
    packages/web/src/components/search/DataSearch.js on lines 121..131

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

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

        updateQuery = (value, props) => {
            const query = props.customQuery || this.defaultQuery;
    
            props.updateQuery({
                componentId: props.componentId,
    Severity: Major
    Found in packages/native/src/components/list/SingleDropdownList.js and 4 other locations - About 2 hrs to fix
    packages/native/src/components/basic/TextField.js on lines 99..110
    packages/native/src/components/list/MultiDropdownList.js on lines 211..222
    packages/native/src/components/range/MultiDropdownRange.js on lines 163..174
    packages/native/src/components/range/SingleDropdownRange.js on lines 105..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 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 4 locations. Consider refactoring.
    Open

            if (this.props.defaultSelected !== nextProps.defaultSelected) {
                this.setValue(nextProps.defaultSelected);
            } else if (this.state.currentValue !== nextProps.selectedValue) {
                this.setValue(nextProps.selectedValue || '');
            }
    Severity: Major
    Found in packages/native/src/components/list/SingleDropdownList.js and 3 other locations - About 2 hrs to fix
    packages/web/src/components/list/SingleDataList.js on lines 81..85
    packages/web/src/components/list/SingleDropdownList.js on lines 100..104
    packages/web/src/components/list/SingleList.js on lines 96..100

    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

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

            checkPropChange(this.props.options, nextProps.options, () => {
                this.setState({
                    options: nextProps.options[nextProps.dataField]
                        ? nextProps.options[nextProps.dataField].buckets
                        : [],
    Severity: Major
    Found in packages/native/src/components/list/SingleDropdownList.js and 2 other locations - About 2 hrs to fix
    packages/native/src/components/list/MultiDropdownList.js on lines 61..67
    packages/web/src/components/basic/TagCloud.js on lines 63..69

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

    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 performUpdate = () => {
                this.setState(
                    {
                        currentValue: value,
                    },
    Severity: Major
    Found in packages/native/src/components/list/SingleDropdownList.js and 2 other locations - About 1 hr to fix
    packages/native/src/components/date/DatePicker.js on lines 108..118
    packages/native/src/components/range/SingleDropdownRange.js on lines 90..100

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

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

            checkPropChange(this.props.dataField, nextProps.dataField, () => {
                this.updateQueryOptions(nextProps);
                this.updateQuery(this.state.currentValue, nextProps);
            });
    Severity: Major
    Found in packages/native/src/components/list/SingleDropdownList.js and 3 other locations - About 1 hr to fix
    packages/native/src/components/range/RangeSlider.js on lines 75..78
    packages/web/src/components/list/SingleDropdownList.js on lines 95..98
    packages/web/src/components/list/SingleList.js on lines 91..94

    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

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

                        const label
                            = this.props.showCount && item.doc_count
                                ? `${item.key} (${item.doc_count})`
                                : item.key;
    Severity: Minor
    Found in packages/native/src/components/list/SingleDropdownList.js and 1 other location - About 55 mins to fix
    packages/native/src/components/list/MultiDropdownList.js on lines 304..307

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

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

        componentWillUnmount() {
            this.props.removeComponent(this.props.componentId);
            this.props.removeComponent(this.internalComponent);
        }
    Severity: Major
    Found in packages/native/src/components/list/SingleDropdownList.js and 15 other locations - About 45 mins to fix
    packages/maps-native/src/components/maps/ReactiveMap.js on lines 210..213
    packages/maps/src/components/result/ReactiveMap.js on lines 345..348
    packages/native/src/components/list/MultiDropdownList.js on lines 94..97
    packages/native/src/components/range/RangeSlider.js on lines 105..108
    packages/native/src/components/search/DataSearch.js on lines 103..106
    packages/web/src/components/basic/TagCloud.js on lines 92..95
    packages/web/src/components/list/MultiDataList.js on lines 100..103
    packages/web/src/components/list/MultiDropdownList.js on lines 118..121
    packages/web/src/components/list/MultiList.js on lines 112..115
    packages/web/src/components/list/SingleDataList.js on lines 88..91
    packages/web/src/components/list/SingleDropdownList.js on lines 107..110
    packages/web/src/components/list/SingleList.js on lines 103..106
    packages/web/src/components/range/RangeSlider.js on lines 110..113
    packages/web/src/components/search/CategorySearch.js on lines 129..132
    packages/web/src/components/search/DataSearch.js on lines 116..119

    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

    There are no issues that match your filters.

    Category
    Status